ode15s differential-algebraic problem
21 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Marco Sammito
le 9 Nov 2016
Réponse apportée : Torsten
le 10 Nov 2016
Hi. I have to solve

and

but I do not get the solution I was supposed to. Could you please tell me if my code is correct? Thank you.
convezione.m file
function out = convezione(t,y)
out = [y(2)
1/y(1)*(-1.5*y(2)^2 + y(2)/y(3) + sin(t))
1/y(1)*((y(2)/y(3))^(1/3) + y(2)/y(3)) - y(3) ];
runconv.m file
function runconv
y0 = [1; 1; 1];
[t,y] = ode15s(@convezione,[0 10],y0);
plot(t,y(:,1))
0 commentaires
Réponse acceptée
Torsten
le 10 Nov 2016
Modifié(e) : Torsten
le 10 Nov 2016
Try
function out = convezione(t,y)
out = [y(2)
1/y(1)*(-1.5*y(2)^2 + y(2)/y(3) + sin(t))
1/y(1)*((y(2)/y(3))^(1/3) + y(1)/y(3)) - y(3) ];
function runconv
y0 = [1; 1; 1.3247^1.5];
[t,y] = ode15s(@convezione,[0 10],y0);
plot(t,y(:,1))
Best wishes
Torsten.
0 commentaires
Plus de réponses (1)
Torsten
le 10 Nov 2016
Sorry, the code was wrong.
Use
function out = convezione(t,y)
out = [y(2)
1/y(1)*(-1.5*y(2)^2 + y(2)/y(3) + sin(t))
1/y(1)*((y(2)/y(3))^(1/3) + y(1)/y(3)) - y(3) ];
function runconv
y0 = [1; 1; 1.3247^1.5];
M = [1 0 0; 0 1 0; 0 0 0];
options = odeset('Mass',M);
[t,y] = ode15s(@convezione,[0 10],y0,options);
plot(t,y(:,1))
Best wishes
Torsten.
0 commentaires
Voir également
Catégories
En savoir plus sur Ordinary Differential Equations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!