how can i use ode45 to solve the states if one of them is matrix or vector?

1 回表示 (過去 30 日間)
Mohamed Aburakhis
Mohamed Aburakhis 2016 年 5 月 3 日
回答済み: Jan 2016 年 5 月 3 日
how can i use ode45 to solve the states if one of them is matrix or vector?
For example , if the state x is scalar, Z is vector (2*1) of states, and P is matrix (2*2) of states %%
states_0=[x0;Z0;P0];
[t,x]=ode45(@derivative,time,states_0);

回答 (1 件)

Jan
Jan 2016 年 5 月 3 日
You can transform the elements of the states to a vector using reshape or (:). Inside derivative() you can use reshape again to process the arrays again, if this is needed.

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by