Finding different length pulses
조회 수: 2(최근 30일)
Star Strider 2020년 9월 18일
Note that ‘clean them up’ is ever so slightly ambiguous.
Assuming that the objective is to remove some of what might be considered ‘noise’, first calculate the Fourier transform of the signal, then using that information to determine where the ‘noise’ frequencies begin, design a lowpass filter to remove the undesirable higher frequencies. (For all of these, the sam;ing intervals must be constant. If it is not, use the resample function to interpolate them to a constant sampling frequency first.)
The Fourier transform is straightforward (assuming ‘x’ is the signal vector):
Fs = ... ; % Sampling Frequency (Hz)
Fn = Fs/2; % Nyquist Frequency (Hz)
L = numel(x); % ‘x’ Is A Vector
xm = mean(x);
xfft = fft(x - xm)/L; % Subtract Mean & Normalise By ‘L’
Fv = linspace(0, 1, fix(L/2)+1)*Fn; % Frequency Vector
Iv = 1:numel(Fv); % Index Vector
With that information, use the lowpass function to design the filter, or use command-line arguments in a script to design your own filter. This is straightforward with the Signal Propcessing Toolbox functions.