Question

In: Computer Science

write a matlab code that you use an ecg signal then extract it at one cycle...

write a matlab code that you use an ecg signal then extract it at one cycle to find the fourier series coefficients the code must be able to regenerate the signal for specific time period determined by the user through GUI. the system must plot the spectrum Cn and )Cn the ecg should generate at different values of N provided by the user through GUI.

only write the code of matlab

Solutions

Expert Solution

n=0.01:0.01:2;
default=input('Press 1 if u want default ecg signal else press 2:\n');
if(default==1)
li=30/72;
  
a_pwav=0.25;
d_pwav=0.09;
t_pwav=0.16;

a_qwav=0.025;
d_qwav=0.066;
t_qwav=0.166;
  
a_qrswav=1.6;
d_qrswav=0.11;
  
a_swav=0.25;
d_swav=0.066;
t_swav=0.09;
  
a_twav=0.35;
d_twav=0.142;
t_twav=0.2;
  
a_uwav=0.035;
d_uwav=0.0476;
t_uwav=0.433;
else
rate=input('\n\nenter the heart beat rate :');
li=30/rate;
  
%p wave specifications
fprintf('\n\np wave specifications\n');
d=input('Enter 1 for default specification else press 2: \n');
if(d==1)
a_pwav=0.25;
d_pwav=0.09;
t_pwav=0.16;
else
a_pwav=input('amplitude = ');
d_pwav=input('duration = ');
t_pwav=input('p-r interval = ');
d=0;
end
  
  
%q wave specifications
fprintf('\n\nq wave specifications\n');
d=input('Enter 1 for default specification else press 2: \n');
if(d==1)
a_qwav=0.025;
d_qwav=0.066;
t_qwav=0.166;
else
a_qwav=input('amplitude = ');
d_qwav=input('duration = ');
t_qwav=0.166;
d=0;
end
  
  
  
%qrs wave specifications
fprintf('\n\nqrs wave specifications\n');
d=input('Enter 1 for default specification else press 2: \n');
if(d==1)
a_qrswav=1.6;
d_qrswav=0.11;
else
a_qrswav=input('amplitude = ');
d_qrswav=input('duration = ');
d=0;
end
  
  
  
%s wave specifications
fprintf('\n\ns wave specifications\n');
d=input('Enter 1 for default specification else press 2: \n');
if(d==1)
a_swav=0.25;
d_swav=0.066;
t_swav=0.09;
else
a_swav=input('amplitude = ');
d_swav=input('duration = ');
t_swav=0.09;
d=0;
end
  
  
%t wave specifications
fprintf('\n\nt wave specifications\n');
d=input('Enter 1 for default specification else press 2: \n');
if(d==1)
a_twav=0.35;
d_twav=0.142;
t_twav=0.2;
else
a_twav=input('amplitude = ');
d_twav=input('duration = ');
t_twav=input('s-t interval = ');
d=0;
end
  
  
%u wave specifications
fprintf('\n\nu wave specifications\n');
d=input('Enter 1 for default specification else press 2: \n');
if(d==1)
a_uwav=0.035;
d_uwav=0.0476;
t_uwav=0.433;
else
a_uwav=input('amplitude = ');
d_uwav=input('duration = ');
t_uwav=0.433;
d=0;
end
  

  
end
pwav=p_wav(n,a_pwav,d_pwav,t_pwav,li);

%qwav output
qwav=q_wav(n,a_qwav,d_qwav,t_qwav,li);
  
%qrswav output
qrswav=qrs_wav(n,a_qrswav,d_qrswav,li);
%swav output
swav=s_wav(n,a_swav,d_swav,t_swav,li);

%twav output
twav=t_wav(n,a_twav,d_twav,t_twav,li);

%uwav output
uwav=u_wav(n,a_uwav,d_uwav,t_uwav,li);
%ecg output
ecg=pwav+qrswav+twav+swav+qwav+uwav;
figure(1)
plot(n,ecg);


Related Solutions

matlab code to graph an ecg
matlab code to graph an ecg
Using Matlab, write code to generate Three signal components We will use a sum of sinusoids,...
Using Matlab, write code to generate Three signal components We will use a sum of sinusoids, all of which are sampled at 10 kHz. Signal 1 should contain a sum of sinusoids with frequencies at 25Hz, 40Hz and 75Hz. Signal 2 should contain a sum of sinusoids with frequencies at 600Hz, 730Hz, and 800Hz. Signal 3 should contain a sum of sinusoids with frequencies at 3500Hz, 4000Hz, and 4200Hz. Choose a variety of amplitudes and phase shifts for the sinusoids....
Show the code in matlab to display an ECG graph (I do not want code that...
Show the code in matlab to display an ECG graph (I do not want code that simply calls the ecg function in matlab but how to write that kind of code)
Write a Matlab code for PSK modulation of Polar signal full widht rectangular pulses and data...
Write a Matlab code for PSK modulation of Polar signal full widht rectangular pulses and data rate 1 mbit/s also find PSD of psk and estimate Bandwidth
Use Matlab to write the following 1. Write code to determine whether a year is a...
Use Matlab to write the following 1. Write code to determine whether a year is a leap year. Use the mod function. The rules for determining leap years in the Gregorian calendar are as follows: All years evenly divisible by 400 are leap years. Years evenly divisible by 100, but not by 400, are not leap years. Years divisible by 4, but not by 100, are leap years. All other years are not leap years. For example, the years 1800,...
Need explanation of MATLAB code which creates echo. (SIGNAL PROCESSING) If the original audio signal is...
Need explanation of MATLAB code which creates echo. (SIGNAL PROCESSING) If the original audio signal is x(t) then the echo is y(t) = x(t) + alpha*x(t-delay) This code below creates this echo however I don't understand how every line of the code works, could someone comment this code so I can understand? [x,Fs] = audioread('Hallelujah.wav'); sound(x,Fs); delay = 0.5; % 0.5s delay alpha = 0.65; % echo strength D = delay*Fs; y = zeros(size(x)); y(1:D) = x(1:D); for i=D+1:length(x) y(i)...
I need MATLAB layout programming for patient monitoring system which consists of ECG signal,body temperature, pulse...
I need MATLAB layout programming for patient monitoring system which consists of ECG signal,body temperature, pulse rate and blood pressure. Please do it quickly.
Write a code to generate a 5 kHz signal using timer. Vary it's duty cycle. Don't...
Write a code to generate a 5 kHz signal using timer. Vary it's duty cycle. Don't use delay function. using any language
Write a MATLAB program to generate a Gaussian window and apply it to a signal as...
Write a MATLAB program to generate a Gaussian window and apply it to a signal as follows: 1)Generate a time vector from 0 to 1 seconds with an interval of 0.001 second 2)Generate two sinusoid signals with a frequency of 90 Hz and 100 Hz, respectively, and add them together 3)Generate a Gaussian window and apply it to the combined sinusoid signal 4)Plot an overlay of the original signal and the windowed in the same figure 5)Add a legend to...
Matlab Code that does the following: Takes as input 3 frequencies. Create a signal that is...
Matlab Code that does the following: Takes as input 3 frequencies. Create a signal that is a mixture of the 3 signals. Create a bandpass filter that only selects the center frequency. Output the filtered signal which contains only the middle frequency. Plot in time and frequency domain the original signal and the filtered signal. Show the output for filter order 1 and 15. Upload a pdf of the image files. Each figure should have your name in the title...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT