You have not clearly stated what you want to do.
You also have problems in your calculations, and your data are not uniformly sampled.
First, you need to use the Signal Processing Toolbox resample (link) function to regularly sample your data. Create a time vector for the resampling (interpolation) as: tv = linspace(min(date), max(date), size(data,1));
From the documentation:
- y = resample(x,tx) resamples the values, x, of a signal sampled at the instants specified in vector tx. The function interpolates x linearly onto a vector of uniformly spaced instants with the same endpoints and number of samples as tx. NaNs are treated as missing data and are ignored.
Second, you are not calculating the sampling interval and therefore the sampling frequency correctly. Calculate them as:
Ts = mean(diff(tv));
Fs = 1/Ts;
Fn = Fs/2;
Then do a fft (link) on your resampled data to determine the frequencies you want to pass or reject, and specify your filter accordingly. I cannot do that because I do not know what you want to do. Use the filtfilt function, not filter, to do the actual filtering.
Best Answer