Noise in ECG data
20 views (last 30 days)
Show older comments
hi, I am doing project of ECG acquiring on C5505. I got results successfully on the PC Application. My ECG results are good and their shape matches those available on the real ECG machines.
But the ECGs are still suffering from some humming noise. So when I plot the data on Matlab, I got all forms of zig-zags.
I want to know is it possible that fft of the signal is taken and noise is removed, that is those frequency components can be removed from them in Matlab??
I got the fft spectrum, but the plot does not show the frequency information related to samples...How I will extract the frequency info??
Thanks.
1 Comment
Sean de Wolski
on 20 Jul 2011
Can you show us what you've done and supply a small set of sample data?
Answers (6)
Rick Rosson
on 20 Jul 2011
Hi Talha,
- Do you know the sampling rate of the signal?
- Also, what is the size of the time-domain representation (how many rows and columns)?
- Can you please show us your MATLAB code?
Thanks.
Rick
Rick Rosson
on 21 Jul 2011
Hi Talha,
- Why are you using low-pass and band stop filters? Why not use two band-stop filters?
- Is the noise you are trying to remove related to 50 Hz electrical power? Is it the fundamental (50 Hz) and the second harmonic (100 Hz) of the electrical power supply? If yes, have you considered using two notch filters, one at 50 Hz and the other at 100 Hz?
- How did you design the low-pass and band-stop filters? Did you use the FDATool, MATLAB filter design function calls, or some other method? If you designed by function calls, can you please post your filter design code?
- Can you please post the filter coefficients for both filters?
- How did you apply the two filters? Can you please post your filter application code?
Thanks!
Rick
0 Comments
Rick Rosson
on 21 Jul 2011
Hi Talha,
Here is some improved code:
%%Computations:
x = d;
[N,P] = size(x);
Fs = 500;
dt = 1/Fs;
t = dt*(0:N-1)';
dF = Fs/N;
f = (-Fs/2:dF:Fs/2-dF)';
X = fftshift(fft(x))/N;
Xpsd = 20*log10(abs(X));
%%Plotting:
for k = 1:P
figure;
subplot(2,1,1);
plot(t,x(:,k));
subplot(2,1,2);
plot(f,Xpsd(:,k));
title(['Time Domain and PSD for Channel #' num2str(k)]);
end
%%Filtering:
% Specify:
spec(1) = fdesign ...
spec(2) = fdesign ...
% Design:
filt(1) = design(...);
filt(2) = design(...);
% Filter:
y = filter(filt(1),x);
z = filter(filt(2),y);
Rick Rosson
on 21 Jul 2011
Everything that you are doing looks correct, as far as I can tell. When you say that "Passing through the filters causes ripples", what exactly do you mean? Are you seeing "ripples" in the time domain signal, or in the frequency domain representation? Can you please post one or more screen shots showing the signal before and after passing through the two filters?
7 Comments
Rick Rosson
on 25 Jul 2011
Yes, that could very much affect the results. Please try designing your filters for Fs of 250 samples per second, and then reapplying them to the signal. That might do the trick.
Bjorn Gustavsson
on 26 Jul 2011
Talha, what is the noise you're after in your original image? Is it the point-to-point variation? If so you should be fine with a very simple low-pass filter, something you'd need to use only matlab's filtfilt or filter functions. Something like this:
I_filtered = filtfilt([.5,1,.5]/2,1,I_original);
HTH
2 Comments
Bjorn Gustavsson
on 26 Jul 2011
I don't know enough about ECG-signals to know what is "true" ECG signal and what constitutes base-line variations. But considering that you only show us ~2 periods it might be completely impossible to determine. I suggest you could do something similar to conditional integration - but here rather "conditional resampling" (I just made that one up.):
Identify the peak of the spikes (the ones at ~2690 and 2950 and so on) then resample/interpolate something like this:
iPeaks = find-local-peaks(ECG);
for i1 = 1:(length(iPeaks)-1),
iCurr = iPeaks(i1):iPeaks(i1+1);
ECGresampled(i1,:) = interp1(t(iCurr),ECG(iCurr),linspace(t(iCurr(1)),t(iCurr(end)),nS);
end
That should give you a 2-D matrix with the individual ECG-periods along the rows and might give you some view of variations in base-line variations that are way slower than one ECG-period. How to determine what is ECG-signal and what is base-line variations in a single period I would not like to tell! Maybe this flutter is a heart condition but not that one over there...
haneen
on 1 Feb 2014
hi , i am haneen my broject (removes the baseline wander in ecg signal by using wavelet transform) so, i need code in matlab to do this, thanks
0 Comments
See Also
Categories
Find more on Single-Rate Filters in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!