Remove the baseline wander

조회 수: 13 (최근 30일)
Anna Karima
Anna Karima 2019년 9월 4일
편집: Anna Karima 2020년 5월 4일
I want to remove the motion artifacts from my signal. I am using matlab for the signal processing and this code for the serial communication with arduino. How can I do the motion artifacts removal?
clc
close all
clear all
if ~isempty(instrfind)
fclose(instrfind);
delete(instrfind);
end
%close all
clc
disp('Serial Port Closed')
s = serial('COM5','BaudRate',9600);
fopen(s);
fprintf(s,'*IDN?');
i = 1;
while true
x(i) = str2double(fscanf(s));
i = i + 1;
plot(x)
pause(0.1)
end
  댓글 수: 1
Star Strider
Star Strider 2019년 9월 4일
Use a highpass (or bandpass) filter. If you are doing this in real time, implement it in hardware.

댓글을 달려면 로그인하십시오.

채택된 답변

Star Strider
Star Strider 2019년 9월 4일
1)So I can't use a digital filter for processing the real time signal continuously?
I’m not aware of any MATLAB ability to do real-time digital filtering. The Audio Toolbox may have this ability, however I don’t have it so I have no experience with it.
2)I probably can save let's say 5 minutes of the signal and then filter it with a digital filter?
That’s certainly an option. The highpass and bandpass functions (R2018a and later) make the filter design much easier. (Return the second argument as the designeed filter, then use it with your signals with the filtfilt function to filter other signals.) If you don’t have those functions, it is easy to design an efficient ellliptic filter to do what you want.
For example:
Fs = 1000; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
Wp = [859 862]/Fn; % Passband Normalised
Ws = [855 865]/Fn; % Stopband Normalised
Rp = 1; % Passband Ripple (Irrelevant in Butterworth)
Rs = 50; % Stopband Attenuation
[n,Wp] = ellipord(Wp,Ws,Rp,Rs); % Order Calculation
[z,p,k] = ellip(n,Rp,Rs,Wp); % Zero-Pole-Gain
[sos,g] = zp2sos(z,p,k); % Second-Order Section For Stability
figure
freqz(sos, 2^16, Fs) % Filter Bode Plot
s_filt = filtfilt(sos, g, s); % Filter Signal
This designs a bandpass filter with passband frequencies of 859 to 862 Hz, and uses it fo filter signal vector ‘s’. For EKG signal processing, the passband would be 1 Hz to 100 Hz, with the stopbands of 0.5 Hz and 105 Hz.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Digital Filter Design에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by