Issue with velocity signal from measurement

3 views (last 30 days)
I have a velocity response measured from my test setup using electromagnetic sensors. Setup includes a floor and the response is measured from the walking force applied on the floor. The measurement sampling rate was 512 Hz. There is a weird change in the wave trend between 4 to 14 seconds (i.e suddenly going down and up). I detrended the signal to remove the DC effect which did not affect. Later, I applied the butterworth filter with a random cutoff of 0.004 and it fixed the issue with the trend line but changed the amplitude significantly and produced some noise. Do you have any idea what is the best cutoff that I can use or what kind of filter helps me to fix the issue. I also attached my velocity response measured.
clc
close all;
clear all;
filename1= 'Root1velocity.xlsx';
xlRange1='A1:A15361';
xlRange2='B1:B15361';
sheet=1;
[num1,txt1,raw1] = xlsread(filename1,sheet,xlRange1);
t=num1;
[num2,txt1,raw1] = xlsread(filename1,sheet,xlRange2);
Vel=num2;
%%%%%%%%%%detrend signal
subsetA_det=detrend(Vel)
plot(t,subsetA_det);
xlabel('time (s)') ;
ylabel('Vel(mm/s)');
hold on
%%%%%%%%%%%%%Butterworth (Highpass filter)
[b1 a1]= butter (2,0.004,'High')
filter_acc1 = filter (b1,a1,subsetA_det)
plot(t,filter_acc1);
legend('original signal','filtered')

Accepted Answer

Star Strider
Star Strider on 21 Oct 2020
First, if you want to eliminate noise, use a lowpass filter, and if you have a significant amount of baseline offset or baseline drift, use a bandpass filter. A highpass filter is exactly the opposite of what you need to do!
Try this:
D1 = readmatrix('Root1velocity.xlsx');
t = D1(:,1);
s = D1(:,2);
Ts = mean(diff(t));
% Tssd = std(diff(t));
Fs = 1/Ts;
Fn = Fs/2; % Nyquist Frequency
L = numel(t); % Signal Length
FTs = fft(s)/L;
Fv = linspace(0, 1, fix(L/2)+1)*Fn;
Iv = 1:numel(Fv);
figure
loglog(Fv, abs(FTs(Iv))*2)
grid
xlabel('Frequency (Hz)')
ylabel('Amplitude')
xlim([0 100])
s_filt = lowpass(s, 0.8, Fs); % Lowpass Filter
figure
plot(t, s)
hold on
plot(t, s_filt)
hold off
grid
xlabel('Time (s)')
ylabel('Amplitude')
legend('Original', 'Filtered')
xlim([0 40])
This is as noise-free as I can get your signal. The lowpass function produces an efficient filter, however you can design your own if you wish (I can help you with that). One additional option is to approximate the filtered signal with a Savitzky-Golay filter (the sgolayfilt function) that can probably removee even more noise. I leave you to explore that.
  4 Comments
Mehdi Ebadi
Mehdi Ebadi on 22 Oct 2020
Thank you very much! The highpass filter worked.
Star Strider
Star Strider on 22 Oct 2020
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!