system of odes
Afficher commentaires plus anciens
hello i have a system of ode equations i want to solve with ode45. the equations is x1´=s*(x2-x2*x1-x1-q*(x1^2) x2´=(-x2-x1*x2+x3)/s x3´=w*(x1-x3) were s,q and w is constans i also have the conditions x1(0)=30 x2(0)=1 x3(0)=30
i've defined the system of equations in the function fxx,
function yprime=fxx(x,s,q,w) global s; global q; global w; x = zeros(3,1); yprime=[s*(x(2)-x(2)*x(1)-x(1)-q*(x(1)).^2); (-x(2)-(x(1))*x(2)+x(3))/s; w*(x(1)-x(3))]; end
and then i run the command [t,x]=ode45(@fxx,[0 10],[30 1 30]) then i get the errors ??? Error using ==> mldivide Matrix dimensions must agree.
Error in ==> fxx at 4 yprime=[s*(x(2)-x(2)*x(1)-x(1)-q*(x(1)).^2); (-x(2)-(x(1))*x(2)+x(3))/s; w*(x(1)-x(3))];
Error in ==> odearguments at 109 f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ==> ode45 at 173 [neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ... and sometimes i get that x is undefined, im sure i have added the folder to matlab
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!