# Invalid expression. Check for missing or extra characters.

6 views (last 30 days)
Jeslin Joseph on 3 Dec 2021
Commented: Image Analyst on 3 Dec 2021
Using the EKG simulator posted in eLearning, generate 20 cycles of the EKG waveform (when displaying the original, noisy or filtered signals in time-domain, show only two or three cycles).
(a) (10 points) Display the original EKG signal both in time-domain and frequency-domain.
(b) (10 points) Add the following two noises to the original signal: - a 60 Hz noise (with an amplitude of 1). - an additive white Gaussian noise (AWGN), i.e. independent and identically-distributed (i.i.d.) Gaussian random variables with 𝜇 = 0 and 𝜎 = 2. Display the noisy signal both in time-domain and frequency-domain.
(c) (20 points) Analyze the spectra of the original and noisy signals and design a suitable filter to extract the EKG signal from the noisy signal. Display the filter’s response. Display the filtered signal both in time-domain and frequency-domain.
Fs=1000;
t=0:(1/Fs):1-(1/Fs);
DISP_ECG_COUNT = 1000;
L = 50;
Ns=L;
ProjectPath = pwd;
ECGPath = strcat(ProjectPath,'\EKG_1.txt');
A=[];
fpt_1 = fopen(ECGPath,'r');
A = fscanf(fpt_1,'%g');
No_of_Data = length(A);
fclose(fpt_1);
x=[];
for r=1:DISP_ECG_COUNT
x(r) = A(r,1);
end
figure:
plot(x);
title('Orignal ECG Signal Time Domain')
xlabel('time')
ylabel('amplitude')
##### 1 CommentShowHide None
Stephen23 on 3 Dec 2021

Image Analyst on 3 Dec 2021
This line
figure: % No - don't use colon
should be
figure; % Use semicolon instead.
##### 2 CommentsShowHide 1 older comment
Image Analyst on 3 Dec 2021
OK, fine, but I don't need them. Getting rid of the colon got rid of the error "Invalid expression. Check for missing or extra characters." so I believe I solved your original error issue, right? I'm not going to do your whole homework for you.