Azzera filtri
Azzera filtri

How to filter a sensor-measured signal to its theoretical form

4 visualizzazioni (ultimi 30 giorni)
Hello,
I used sensors to measure EMG signals, and it looks like this: (the original data is attached)
However, its theoretical form is this:
That is, it seems the lab measured data is subjected to some bias. How can I remove that bias?
Thank you very much if you could answer me this question!

Risposta accettata

Star Strider
Star Strider il 1 Mag 2022
Using the results of the fft, a highpass cutoff frequency of ‘0.02*Fs’ appears to be appropriate —
T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/984450/1.txt', 'VariableNamingRule','preserve')
T1 = 2035×2 table
Var1 Var2 _____ _____ 75954 80997 74125 80310 76792 85030 76799 85062 76807 85087 76821 85126 76838 85170 76873 85240 76902 85318 76944 85411 76993 85506 77036 85619 77086 85720 77128 85833 77166 85943 77203 86043
s1 = T1.Var1;
s2 = T1.Var2;
Fs = 1; % Sampling Frequency (Use The Correct Value)
L = size(T1,1);
t = linspace(0, L-1, L)/Fs; % Time Vector
figure
plot(t, s1, t, s2)
grid
legend('s_1', 's_2', 'Location','best')
Fn = Fs/2; % Nyquist Frequency
NFFT = 2^nextpow2(L); % Efficient 'fft' Length
FTs1s2 = fft([s1 s2]-mean([s1 s2]),NFFT)/L; % Fourier Transform (Subtract 'mean' To Show Peaks More Clearly)
Fv = linspace(0, 1, NFFT/2-1)*Fn; % Frequency Vector
Iv = 1:numel(Fv); % Index Vector
figure
plot(Fv, abs(FTs1s2(Iv,:))*2)
grid
xlabel('Frequency')
ylabel('Amplitude')
legend('s_1', 's_2', 'Location','best')
xlim([0 0.15*Fs])
s1s2_filt = highpass([s1 s2], 0.02*Fs, Fs, 'ImpulseResponse','iir');
figure
subplot(2,1,1)
plot(t, s1s2_filt(:,1))
grid
% xlabel('Time')
ylabel('Amplitude')
title('s_1')
subplot(2,1,2)
plot(t, s1s2_filt(:,2))
grid
xlabel('Time')
ylabel('Amplitude')
title('s_2')
.
  2 Commenti
yuh zhang
yuh zhang il 2 Mag 2022
Hello! You are awsome, thank you so much for helping me!
But, in this code:
s1s2_filt = highpass([s1 s2], 0.02*Fs, Fs, 'ImpulseResponse','iir');
is "0.02*Fs" chosen because there is a power peek at fre=0.02 in frequency-Amp chart?
Star Strider
Star Strider il 2 Mag 2022
I very much appreciate your compliment!
As always, my pleasure!
That frequency was chosen because it includes the first peak at about 0.025*Fs and everything greater than that. (There is no significant high-frequency noise, so a bandpass filter is not necessary with this signal.) You can experiment with other frequencies (between 0.01*Fs and 0.02*Fs) to see if that produces any better results.
It would be straightforward to also experiment with a bandpass filter. The upper frequency should likely be in the range of 0.04*Fs to 0.1*Fs for best results, depending on the result you want. This would eliminate what little high-frequency noise that exists in the signal, and depending on the chosen frequency, will also elimiinate all or part of the other two peaks (referring to the fft plot).
.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Signal Processing Toolbox in Help Center e File Exchange

Prodotti


Release

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by