Using ODE45 to solve a state space system.
Afficher commentaires plus anciens
Hello there!
I stucked in how to use ode45. My problem is the following:
I have a ODE that i want to solve, the only difference is that my initial conditions are vector 3x1.
*function xdot = double_int2(t, y)
xd1 = y(2,:) % xdot = v
xd2 = temp2 + Td % temp2 and Td are vector 1x3
end*
and the other function
*
function [T,Y] = call_double_int2()
x01 = [10 0 0 ];
v01 = [1 0 0];
t_span = [0 5];
[T,Y]= ode45(@double_int2, t_span, [x01 v01])
end*
So, I don't know how to implent in wat that MatLab understand it`s a row vector, I tried to declare the funcion as double_int2(t,y(2,3)), but it always take it as a element.
4 commentaires
Francisco
le 17 Juil 2014
Sara
le 17 Juil 2014
From your description, you don't have four ode's but 12 (3 components * 4 variables), which is totally doable in matlab. Let's take the system you have posted originally for simplicity. It will have to be:
x = y(1:3); %not used but added for clarity
v = y(4:6);
xd1 = v;
xd2 = temp2 + Td;
xdot = [xd1,xd2];
since your v is in y(4:6). Is this clearer? If you can't still do it, post ALL the inputs plus whatever code you have.
Francisco
le 23 Juil 2014
Francisco
le 23 Juil 2014
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!