How to clean-up signal from frequencies introduced by interp1?

5 views (last 30 days)
Dear all,
In order to unify the sample interval (SI) of a number of signals, I have run the interp1 function ('pchip'), hence interpolating the signal from 5 minutes (original SI) to 1 minute (interpolated SI). Due to the sharper frequency achieved, the function (interp1) introduced unrealistic frequencies, as is possible to observe on the Power Spectral Density plot (please, see the attached figure below). I would like to get rid of any frequency higher than the original SI of 5 minutes. My expectation is to clean up the interpolated series in a way that the next Power Spectral Density plot just reveals energy at same frequencies as the original signal (up to 10.3 minutes, for example, as shown in the figure). Any help would be precious to solve this issue. I have applied the low-pass lanczosfilter, but it did not efficiently get rid of the undesirable frequencies.
Thank you,

Answers (1)

Star Strider
Star Strider on 29 Mar 2017
I would use the Signal Processing Toolbox resample function instead. It uses a FIR anti-aliasing filter to prevent such problems.
  2 Comments
Gustavo Oliveira
Gustavo Oliveira on 31 Mar 2017
Thank you for the answer,
The interpolated 'power spectral density' looks better after interpolation by 'resample'. Although, the undesired periods (<5min) still appearing on the plot, even after run the 'lanczosfilter' (as shown in the attached figure). My script is as follows:
clear x y yi Ty Fs
x=datetime(5min_original_time, 'ConvertFrom', 'datenum');
x=dateshift(x,'start','second','nearest');
y=5min_data_set;
Fs=0.016666666666667;%Hz
[yi,Ty]=resample(y,x,Fs);
whos x y yi Ty
Ty=datenum(Ty);
% & Filter
clear data_low data
data = yi;% interpolated 1 min data set
[data_low,~,~,~,~]=lanczosfilter(data,0.016666666666666666,0.16666666666666666^-1,[],'low');%Frequency in hours and cut-off as hour^-1
%= cut off of 10 min
whos data_low data
% & PSD by
[P_data,freq_data,Pxxc] = pwelch(data,43200/2,43200/4,43200,0.016666666666667,'ConfidenceLevel',0.95);% 1 min
The undesired frequencies higher than the original SI still appearing. I do not really know if what I am intending to do is possible.
Thank you for your time,
Star Strider
Star Strider on 31 Mar 2017
My pleasure.
I am not familiar with the lanczosfilter function and cannot find it in the documentation. (I assume it is a File Exchange contribution, but I did not search for it.) I did find a Wikipedia article on it.
You may simply have to filter out the high frequency noise. One option you could try is the Savitzky-Golay filter, using the sgolayfilt function. It is essentially a lowpass filter that does a form of windowed curve-fitting in the time domain.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!