How to to filter non-uniformly sampled data?

조회 수: 13 (최근 30일)
riss
riss 2017년 11월 14일
댓글: Star Strider 2017년 11월 27일
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.

채택된 답변

Star Strider
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.
  댓글 수: 2
riss
riss 2017년 11월 27일
Hello Star Strider,
thank you a lot for your answer. It helped me a lot.
Star Strider
Star Strider 2017년 11월 27일
As always, my pleasure.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by