How to to filter non-uniformly sampled data?
12 次查看(过去 30 天)
显示 更早的评论
I've a series of force sensor data acquired by an industrial robot controller. Sadly the data has to be read out in a background task, so the sampling time differs between 1m and 20ms. Due to high oscillation in the process, I have to low-pass filter these force values.
What is the best way to filter this data? Right now, I'm interpolating linear between the data points and than resample with a sampling rate of 1kHz (1ms sampling time). Then I'm using a moving average filter to smooth and filter these data.
But I'm not happy with this method because I neither know how this is changing the validity of my data.
Help is highly appreciated. Thank you.
0 个评论
采纳的回答
Star Strider
2017-11-14
Your approach is correct. Rather than using interp1, use the Signal Processing Toolbox resample (link) function. It incorporates an anti-aliasing filter, and is preferred for signal processing purposes.
A useful lowpass filter design prototype is:
Fs = 360; % Sampling Frequency (Hz)
Fn = Fs/2; % Nyquist Frequency (Hz)
Wp = 100/Fn; % Passband Frequency (Normalised)
Ws = 101/Fn; % Stopband Frequency (Normalised)
Rp = 1; % Passband Ripple (dB)
Rs = 150; % Stopband Ripple (dB)
[n,Ws] = cheb2ord(Wp,Ws,Rp,Rs); % Filter Order
[z,p,k] = cheby2(n,Rs,Ws); % Filter Design
[soslp,glp] = zp2sos(z,p,k); % Convert To Second-Order-Section For Stability
figure(3)
freqz(soslp, 2^16, Fs) % Filter Bode Plot
filtered_signal = filtfilt(soslp, glp, original_signal); % Filter Signal
Make appropriate changes for your signal.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multirate Signal Processing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!