Merging individual waves into a single wave as a synthetic ECG
Show older comments
Hello everyone :)
I created individual ECG waves (P wave, QRS complex, and T wave, which is identical to the P wave) using symbolic variables and the Fourier series. However, I am struggling to merge these waves into a single waveform—it jumps around unpredictably, and I generally don’t know how to proceed. :(
my code is here:
close all;clear all; clc;
%P wave (T wave)
T = 1
f = 1/T
omega = 2*pi*f
syms t k
c=0
a_0 = (1/pi) * int((-t^2), t, c, c + 1);
a_n = (1/pi)*int(-t^2 * cos(k*t),t,c,c+1);
b_n = 0;
FS_P = a_0/2 + symsum(a_n*cos(k*t)+b_n*sin(k*t),k,1,1)
FS_P = 4*FS_P
four = subs(FS_P)
%number of repetitions
N = 1
ezplot(four,0:6.3*N)
grid on
%QRS complex - first part
syms t k x
c=0
a_0 = 0
a_n = 0
b_n = 1/pi * int(t*sin(k*t),x,c,c+2*pi)
FS_QRS = a_0/2 + symsum(a_n*cos(k*t)+b_n*sin(k*t),k,1,1000)
FS_QRS = 2*FS_QRS
four = subs(FS_QRS)
N=4
ezplot(four)
%QRS complex - second part
syms t k x
c=0
a_0 = 0
a_n = 0
b_n = 1/pi * int(-t*sin(k*t),x,c,c+2*pi)
FS_QRs = a_0/2 + symsum(a_n*cos(k*t)+b_n*sin(k*t),k,1,1000)
FS_QRs = -2*FS_QRs
four = subs(FS_QRs)
ezplot(four)
I try to simply add these signals but it doesnt work :(
Accepted Answer
More Answers (0)
Categories
Find more on Pulsed Waveforms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!