The example from internet doesn't work in matlab (ODE45 for solving equation system)
Afficher commentaires plus anciens
Im new on matlab, and ill trying learn how to solve some equation systems using matlab, and ode45 solver. I was tried to use a sample from matlab help, and it works great, but when im trying to solve a little bit difficult equations i get the error. its happen with all my tried was the same ( i have a six motion equation system with 6 variables, so i need to leart how to solve it using matlab) I find some example on internet and try to solve and test it on my computer, but it doesn't work, i get some error:
>> [T, XY] ode45('diffxy',0,10,[0 1 0])
[T, XY] ode45('diffxy',0,10,[0 1 0])
|
Error: Unexpected MATLAB expression.
Can someone help for me?
What is wrong here, what i need to change for the correct result, and what is the mistake explanation?
the *.m code:
function dxy = diffxy(t, xy)
%
%split xy into variables in our equations
%
x = xy(1);
xdot = xy(2);
y = xy(3);
%
% define the derivatives of these variables from equations
%
xdot = xdot;
ydot = 3*x + 2*y + 5;
xdoubledot = 3 - ydot + 2*xdot;
%
%return the derivatives in dxy in the right order
%
dxy = [xdot; xdoubledot; ydot]
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Ordinary Differential Equations 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!