How to filter a sensor-measured signal to its theoretical form
3 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I used sensors to measure EMG signals, and it looks like this: (the original data is attached)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/984460/image.jpeg)
However, its theoretical form is this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/984465/image.png)
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!
0 件のコメント
採用された回答
Star Strider
2022 年 5 月 1 日
T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/984450/1.txt', 'VariableNamingRule','preserve')
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 件のコメント
Star Strider
2022 年 5 月 2 日
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).
.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Signal Processing Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!