Hello everyone, I got one task:
To construct digital filters for the patient heart rate signal (ECG-signal). System measures voltage differences in patients body with 250 Hz sampling rate. Useful data in ECG is typically from low frequencies to maximum 100 Hz. However during measurement some noise has coupled to system disturbing the data. Noise is from low frequency magnetic fields in hospital as well as high frequency communication networks.
Your task is to build passband filter with Matlab to separate noise from original ECG signal. Project is being done in maximum two person groups. Each group receives own signals with different noise frequencies. Filtering should be done with both FIR and IIR filters.
Program must include following subjects:
Program reads data to be filtered
Shows graphs of unfiltered and filtered signal in time and frequency scale
Shows amplitude response of the filters
Comments about filter performances (FIR and IIR)
Program should have enough comments so that anyone can understand which parts are performed and where.
I wrote some code like this, but not work, Please someone help me about this task. THE attachment is the data file including the noise.
% Design IIR filter that meets these specification:
% Passband cutoff frequencies
fp;
% Stopband cutoff frequencies
fs;
% Sampling rate
Fs=125;
% Attenuations
Ap;
As;
Wp=[fp/(Fs/2)];
Ws=[fs/(Fs/2)];
% Filter order
[N, Wn] = buttord(Wp, Ws, Ap, As);
% Filter coefficients
[B,A] = butter(N,Wn,'low')
y=filter(B,A,x)
subplot(2,1,1)
plot(x)
subplot(2,1,2)
plot