ode 45 formulation of equations in system

1 view (last 30 days)
gorilla3
gorilla3 on 24 Oct 2017
Hi,
I believe I have a mistake in the 1st equation of the system but I am unsure how to formulate it correctly then. Could you help?
The original equation I have troubles with is: d/dt (V_sa)= d/dt(Ca*(P1-P_ic))
Out of completion, here are the others:
  • d/dt P1 = ( (P_a_b-P1)/(R_la+0.5*R_sa_b) - (P1-P2)/(0.5*R_sa_b+R_sv) )/Ca_b
  • d/dt P2= ((P1-P2)/(0.5*R_sa_b+R_sv)-(P2-P_v)/R_lv)/(1/(k_ven*(P2-Pic-Pv1)))
  • d/dt xq= ( -xq*Gq( (( (P1-P2)/(0.5*R_sa_b+Rsv) )-q_b)/q_b ) )/tauq
  • d/dt xc= (-xc+0.3+0.3*tanh(Pa_co2/Pa_co2_b -1.1))/tau_co2
  • d2/dt xm= (eps*u-tau2*(d/dt xm)-xm)/tau1^2
I'm insecure about the 1st (V_sa), the rest should be fine. It'd be great if you could help!
This is the code: (All variables in the eq have been declared before but I won't report them here cause it's unnecessary)
F = @(t, sth) [ Ca_b*(sth(2)-P_ic);
((P_a_b-sth(2))/(R_la + 0.5 *R_sa_b) - (sth(2)-sth(3))/(0.5 *R_sa_b+R_sv))/Ca_b;
((sth(2)-sth(3))/(0.5 *R_sa_b +R_sv)-(sth(3)-P_v)/R_lv)/
1/(k_ven*(sth(3)-P_ic-P_v1)) ;
(-sth(4)+G_q*(( (sth(2)- sth(3))/(0.5 *R_sa_b + R_sv) ) -q_b )/q_b )/tau_q ;
(-sth(5) +0.3+3*tanh(Pa_co2/Pa_co2_b -1.1))/tau_co2;
sth(7);
(eps*u-tau2*sth(7)-sth(6))/tau1^2 ];
[t, sth] = ode45(F, [0 100], [0 0 0 0 0 0 0]);
V_sa = sth(:,1);
P1 = sth(:,2);
P2 = sth(:,3);
xq= sth(:,4);
xc= sth(:,5);
xm= sth(:,6);
xm1= sth(:,7);

Answers (0)

Categories

Find more on Parallel Computing Toolbox 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!