i want code for the below given task

13 次查看(过去 30 天)
Load an ECG signal. Add a 50 Hz, 100 Hz and 150 Hz frequency sinusoidal signals to this ECG signals. Plot the original ECG signal, corrupted ECG signal and their spectrum.
  3 个评论
Peng Li
Peng Li 2020-4-4
You are asking too much. You have at least to try by yourself first and if there are any questions you have, I'm happy to help take a pic, and if I'm not the person who can provide an answer, I think there will be others.
See below my answer to your first problem. It's showing an example of showing an ECG recording, and contaminate it by 50 Hz noise with SNR roughly 1:1.
I guess you might have a course project or something...
Ameer Hamza
Ameer Hamza 2020-4-4
Exactly, this is clearly an assignment or a project. I hope that you don't expect us to complete it for you. As Peng mentioned, you need to show some code that you have already tried. This forum is focused on MATLAB related questions, e.g., errors, syntax issues, suggestions, etc. Your problem is not specifically related to MATLAB, and it is still very kind of Peng to solve Task 1 of the assignment for you. Now you can extend it further to solve the other two tasks.

请先登录,再进行评论。

采纳的回答

Peng Li
Peng Li 2020-4-4
close all; clear;
%% this is an examplary ECG recording with sampling frequency 200 hz
y = load('2GCCY.txt');
fs = 200;
N = length(y);
% show data
hfd = figure('Name', 'Orignal data and contaminated data');
had1 = subplot(211);
t = (0:1/fs:(N-1)/fs)';
plot(had1, t, y);
% zoom in to better visualize data
had1.XLim = [0 20];
title('Original ECG');
xlabel('time (s)');
% add 50 Hz noise, SNR 1:1
fn1 = 50;
n50 = std(y).*sin(2*pi*fn1*t);
yn50 = y + n50;
had2 = subplot(212);
plot(had2, t, yn50);
had2.XLim = [0 20];
title('Original ECG contaminated by 50 Hz noise');
xlabel('time (s)');
%% fft
Fy = fft(y);
f = fs/N .* ((-N/2+1):N/2);
% show fft
hff = figure('Name', 'FFT');
haf1 = subplot(211);
plot(f, fftshift(abs(Fy)./N));
haf1.XLim = [0 fs/2];
title('Amplitude spectrum of orignal ECG');
xlabel('Frequency (Hz)');
ylabel('Amplitude spectrum');
% fft of contaminated data
Fyn50 = fft(yn50);
% show fft
haf2 = subplot(212);
plot(f, fftshift(abs(Fyn50)./N));
haf2.XLim = [0 fs/2];
title('Amplitude spectrum of ECG + 50 Hz noise');
xlabel('Frequency (Hz)');
ylabel('Amplitude spectrum');

更多回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by