Experiment 4:ECG Filtering and Noise removal

In this experiment you will you will generate randon noise and add to a ECG signal using MATLAB. Then a averaging filter will be used to attenuate the noise.

  1. The ECG signal given in the following data files is sampled at 1 KHz and has integer values. Resample the signal (with MATLAB)at 250 Hz and take the first 1000 samples.ECG Data File (Use the first column of the file)
  2. As the signal has interger values, rescale the signal samples between + 0.1 to - 0.1. (call it ecginput[n]]). Noise will be added to this signal.
  3. Generate randon noise signal of length 1000 samples (same as that of ecginput) with values between +1 to -1 using matlab.
  4. Calculate energy of the signal ecginput[n] and add the noise to the ecginput[n] with the SNR values of 0db, 5db and 10db.
  5. Rest of the filtering is to be done in VisualDSP

    .

  6. Now filter these signals (in the last experiment you have the background on circular buffers and with that you can make program for FIR filter) with a averaging filter of length M (repeat the experiment with M= 4 and 8). The differnce equations should be:

      y[n] = (x[n] h[0] +x[n1-1]h[1]+x[n-2][2].....+x[n-M-1][M-1])

      Where h[n] = 1.0/M;
  7. Find the output signal and save it on the hard disk. Show the plot of input and output signal with MATLAB.
  8. Also show the spectrum of the noisy signal and filtered output signal in each case.