How to to filter non-uniformly sampled data?

12 Ansichten (letzte 30 Tage)
riss
riss am 14 Nov. 2017
Kommentiert: Star Strider am 27 Nov. 2017
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.

Akzeptierte Antwort

Star Strider
Star Strider am 14 Nov. 2017
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 Kommentare
riss
riss am 27 Nov. 2017
Hello Star Strider,
thank you a lot for your answer. It helped me a lot.
Star Strider
Star Strider am 27 Nov. 2017
As always, my pleasure.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by