Solving coupled differential equations
Afficher commentaires plus anciens
T o solve my coupled differential equations. I made the following function
======================
function x_value = reservoir(t,y);
s1 = y(1); s2 = y(2); s3 = y(3);
p1 = y(4); p2 = y(5); p3 = y(6);
x1 = 5.45*10^(-6);
x_value = [s1; s2; s3; p1; p2; p3];
h = 0.7844; b = 5*10^(-7); e = 8.8750*10^(-2); v = 7.54; g1 = 2500; g2= 2500; g3 =2500; x1 = 5.45*10^(-6); x2 = 5.45*10^(-6); x3 = 5.45*10^(-6);
% Define constants.
Dp1 = diff(p1); Dp2 = diff(p2); Dp3 = diff(p3);
Ds1 = diff(s1); Ds2 = diff(s2); Ds3 = diff(s3);
% Generate differentiations.
diffqp1 = Dp1 == h*b*s1*(g1-p3)-(e/v)*p1;
diffqp2 = Dp2 == h*b*s2*(g2-p1)-(e/v)*p2;
diffqp3 = Dp3 == h*b*s3*(g3-p2)-(e/v)*p3;
diffqs1 = Ds1 == x1/v-h*b*s1*(g1-p3)-(e/v)*s1;
diffqs2 = Ds2 == x2/v-h*b*s2*(g2-p1)-(e/v)*s2;
diffqs3 = Ds3 == x3/v-h*b*s3*(g3-p2)-(e/v)*s3;
% Generate differential equations.
end
===========================
And to derive explicit s1~p3 values, i used the code below.
===========================
[s1, s2, s3, p1, p2, p3] = ode45(@reservoir,[0 1],[0; 0; 0; 0; 0; 0]) ===========================
But it said " While using 'ode45' there wasn't proper substitute to output parameter 'varargout{4}'
My terminal goal is to derive s1~p3 values at each t=1,2,....so on, when i want!! How can I derive this?
Please help me!
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur 상미분 방정식 dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!