Solving two equations with ODE45
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Sergio Manzetti
le 4 Avr 2018
Modifié(e) : Sergio Manzetti
le 4 Avr 2018
Hi, I used the following command to solve one ODE
fun = @(x,y)[y(2);y(3);(y(1)*(1-x^2))];
y0 = [1 0 8]; %y, y', y''
xspan = [-3 3];
[X,Y] = ode45(fun,xspan,y0);
plot(X,Y(:,1)),,% X,Y(:,2),X,Y(:,3),X,Y(:,1).* (2 + X .^ 2));
However, I would like to solve this pair of equations instead of the given "fun":
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/171794/image.jpeg)
How do I add two equations in the fun line?
Thanks!
0 commentaires
Réponse acceptée
Torsten
le 4 Avr 2018
fun=@(x,y)[y(2);y(3);-(1+x^2)*y(4);y(5);y(6);(1+x^2)*y(1)]; %psi2,psi2',psi2'',psi1,psi1',psi1''
Best wishes
Torsten.
9 commentaires
Plus de réponses (1)
Voir également
Catégories
En savoir plus sur Integrated Circuits 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!