Carlos,
I like your function moving_average, very easy to use. I have data which has small to large time gaps and I don't want to filter across the gaps. I could break the vector up at each gap but that would mean work. Any suggestion on how to handle something like this?
5
17 Sep 2009
moving_average v3.1 (Mar 2008)
Smooths a matrix (with/without NaN's) via recursive moving average method and eliminates data gaps.
Dear all, I'm dealing with gap filling on weather measurements which the NaN should be filled based on the time window of several days.(i.e., neighborhood hour of several days).
For example, one NaN at 5pm will be replaced by the mean value in the neighborhood hour of neighborhood several days. (let's say 4, 5 and 6pm of neighborhood 5 days)
Here is the bone of question I like to deal with:
values = rand(1,1000)';
fake_NaN = floor(rand(1,300)'*1000);
values(fake_NaN) = NaN;
for i = 1:length(values)
n = 24 * i * (1:5)
having_nan_index = find(isnan(values))
new_values = nanmean(values(having_nan_index * n-1:having_nan_index*n+1))
:
:
Something like that
:
:
If you have any solutions or advices, please feel free to let me know. Thanks, Michael
5
15 Jan 2009
moving_average v3.1 (Mar 2008)
Smooths a matrix (with/without NaN's) via recursive moving average method and eliminates data gaps.
hi Carlos i have send you an email about the difficulties in programmation of the recursive moving coverage have you any idea about this issue? any help please? thanks by advance