Code covered by the BSD License  

Highlights from
M File Computing Rational Coefficiant For Heart VI1 Simulink

M File Computing Rational Coefficiant For Heart VI1 Simulink

by

 

computing rational coefficiants for heart VI1 simulink-Mfile

v=pacemaker1VI1
function v=pacemaker1VI1
%PROGRAM INTEGRATION MODEL PACEMAKER VI1 FOR ALL THE CARDIAC CELLS runge
%kutta 4 matlab R2007a
%dV/dt=(a/c)V^^^3 +(b/C)V^^2 +(do/C)V +d1/C -I1/C +Io/C
%dI1/dt=V/L -(R/L)I1 +E/L
%cardiac parameters 
 a=-0.3;b=0.3;do=0.65;d1=0.005;E=90e-3;L=100e-3;C=9600e-6;R=0.4;
Duration=2.4;N=1000;h=Duration/N;w=1024;A=0
%intial conditions
V(1)=-0.05;I1(1)=-0.0096;
for n = 1: 1: 1000
    A1(n) = (a/C)*V(n).^3+(b/C)*V(n).^2+(do/C)*V(n)+d1/C-(1/C)*I1(n)+(1/C)*A*sin((w*n)*h);
    B1(n) = (1/L)*V(n)-(R/L)*I1(n)+E/L;
    A2(n) = (a/C)*(V(n)+(h/2)*A1(n)).^3+(b/C)*(V(n)+(h/2)*A1(n)).^2+(do/C)*(V(n)+(h/2)*A1(n))+d1/C-(1/C)*(I1(n)+(h/2)*B1(n))+(1/C)*A*sin((w*(n+1/2))*h);
    B2(n) = (1/L)*(V(n)+(h/2)*A1(n))-(R/L)*(I1(n)+(h/2)*B1(n))+E/L;
    A3(n) = (a/C)*(V(n)+(h/2)*A2(n)).^3+(b/C)*(V(n)+(h/2)*A2(n)).^2+(do/C)*(V(n)+(h/2)*A2(n))-d1/C-(1/C)*(I1(n)+(h/2)*B2(n))+(1/C)*A*sin((w*(n+1/2))*h);
    B3(n) = (1/L)*(V(n)+(h/2)*A2(n))-(R/L)*(I1(n)+(h/2)*B2(n))+E/L;
    A4(n) = (a/C)*(V(n)+(h/2)*A3(n)).^3+(b/C)*(V(n)+(h/2)*A3(n)).^2+(do/C)*(V(n)+(h/2)*A3(n))+d1/C-(1/C)*(I1(n)+(h/2)*B3(n))+(1/C)*A*sin((w*n)*h);
    B4(n) = (1/L)*(V(n)+h*A3(n))-(R/L)*(I1(n)+h*B3(n))+E/L;
    V(n+1) = V(n)+(h/6)*(A1(n)+A2(n)+2*A3(n)+A4(n));
    I1(n+1) = I1(n)+(h/6)*(B1(n)+B2(n)+2*B3(n)+B4(n));
end        
plot(V)
title(['a= ', num2str(a),' b= ', num2str(b),' do= ', num2str(do),' d1= ', num2str(d1),' E= ', num2str(E),' R= ', num2str(R),' L= ', num2str(L),' C= ', num2str(C), 'Duration= ', num2str(Duration),'A= ', num2str(A), 'w= ', num2str(w)])
title(['a/C= ', num2str(a/C),' b/C= ', num2str(b/C),' do/C= ', num2str(do/C),' d1/C= ', num2str(d1/C),' E/L= ', num2str(E/L),' R/L= ', num2str(R/L),' 1/L= ', num2str(1/L),' 1/C= ', num2str(1/C)])
end


    

Contact us