How to plot a isovolumetric pressure loop for a left venticle model?
Show older comments
Hi, I need some major help, Im tasked with using matlab to build a preesure- volume loop to model the left ventricle but have absolutely no idea how to put the equations into matlab properly.
Here is my code:
% solves the steady state pressure-volume model for the left venticle
global R0 Rs Cs Rin Pr a b c d Tp Ts T Vv;
R0 = 0.06; % mmHg.s/cm^3
Rs = 1.0; % mmHg.s/cm^3
Cs = 2.75; % cm^3/mmHg
Rin = 0.001; % mmHg.s/cm^3
Pr = 10; % mmHg
a= 0.0005;% mmHg/cm^3
b = 6.0;% cm^3
c = 1.5;% mmHg/cm^3
d = 1.0; % mmHg
Tp = 0.35; % s
Ts = 0.8; % s
T = 1.0; % s
Vv = 250; % ml
% solve model
if true
% code
end
[time, Yout] = ode15s('IPM', [0 20], [0 100]);
% plot model
plot(time, Yout(:,2)),xlabel('Volume'), ylabel('Pressure (mmHg)'), ...
title('Steady State Pressure Volume loop of the Left Ventricle');
And my function:
function Yprime = IPM(t,Y)
Yprime = zeros(2,1);
global R0 Rs Cs Rin Pr a b c d Tp Ts T;
% first, determine phase time within each beat
tt = mod(t,T);
% next, calculate ventricular pressure
if (tt < Tp)
f = (sin((pi*tt)/(2*Tp)))^2;
elseif (tt < Ts)
f=(cos((pi*(T-Tp))/(2*(Ts-Tp))))^2;
else
f = 0;
end;
Ps = Y(1);
Vv = Y(2);
Pv = a*(Vv-b)^2 +(c*Vv-d)*f;
if (Pr > Pv)
Qin = (Pr-Pv)/Rin;
else
Qin = 0;
end
if (Pv>Ps)
Qout= (Pv-Ps)/R0;
else
Qout = 0;
end
Yprime (1) = Qout/Cs -Ps/(Rs*Cs);
Yprime (2) = Qin - Qout;
it should be a loop but currently is more like a square wave plot
3 Comments
Ananthi P
on 2 Jul 2021
Hi, did you get answer to the above question? If yes, please let me know, that will be very helpful. I have a similar problem to solve.
ola ahmed
on 23 Dec 2022
can you please help me with the main equations?
I'm tring to make the same program but i think iam missing an eqution so I am stuck in a loop
Sulaymon Eshkabilov
on 24 Dec 2022
What is your equation that you are trying to simulate?
Answers (0)
Categories
Find more on Ordinary Differential Equations 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!