Using ODE45 to solve a state space system.
古いコメントを表示
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 件のコメント
Francisco
2014 年 7 月 17 日
Sara
2014 年 7 月 17 日
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
2014 年 7 月 23 日
Francisco
2014 年 7 月 23 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Ordinary Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!