How to filter a sensor-measured signal to its theoretical form
조회 수: 4 (최근 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!