% The function var_acap.m computes the atrial elastance and derivative % of the elastance for a desired time step. % % Function arguments: % Cs - atrial end-systolic compliance (ml/mmHg) % Cd - atrial diastolic compliance (ml/mmHg) % Tp - previous cardiac cycle length (s) % sumdeltaT - time surpassed in current cardiac cycle (s) % % Function outputs: % E - atrial elastance at the desired time step (mmHg/ml) % dE - derivative of E at the desired time step (mmHg/ml-s) % function [E,dE] = var_acap(Cs,Cd,Tp,sumdeltaT) % Making the atrium a passive element, if Cd is less % than Cs. if (Cd <= Cs) E = 1/Cd; dE = 0; else % Assigning variables. Ts = 0.15*sqrt(Tp); Tir = Ts/2; % Calculating values during isovolumic contraction phase. mbrealscalar(sumdeltaT < Ts); if (sumdeltaT < Ts) E = (((1/Cs)-(1/Cd))/2) * (1-cos((pi/Ts)*sumdeltaT)) + (1/Cd); dE = (pi/Ts)*(((1/Cs)-(1/Cd))/2) * sin((pi/Ts)*sumdeltaT); % Setting values during diastolic filling phase. mbrealscalar(sumdeltaT >= Ts+Tir); elseif (sumdeltaT >= Ts+Tir) E = 1/Cd; dE = 0; % Calculating values during isovolumic relaxation phase. else E = (((1/Cs)-(1/Cd))/2) * (1+cos((pi/Tir)*(sumdeltaT-Ts))) + (1/Cd); dE = -(pi/Tir)*(((1/Cs)-(1/Cd))/2) * sin((pi/Tir)*(sumdeltaT-Ts)); end end