ode45を使用して毎時間微分方程式を解かせたい
Mostrar comentarios más antiguos
2次のODEをシミュレーション中に解きたいと考えています. 自分で離散化すると, 自分の技術知識不足によりかなり不安定な結果になってしまったのでMATLABのode45を使って解きたいと考えています. イメージとしては次のようなコードです.
このコードのcal_aの中でode45を使おうとしたのですが, 「関数または変数が認識されません。」というエラーになりました.
やり方の検討もつかないので教えていただきたいです.
function main
%初期値の設定
%%%%
result_b = cal_b();
while Time(i) < Time_finish
%次の時刻でのAの計算(Bの結果が必要)
[result_a]= cal_a(result_b);
%次の時刻でのBの計算
[result_b] = cal_b();
%次の時刻でのCの計算(A, Bの結果が必要)
pressure_Bubble_next = Bubble_pressure(result_a, result_b);
%値の更新
i = i+1;
end
1 comentario
宇海
el 1 de Sept. de 2023
Respuesta aceptada
Más respuestas (1)
宇海
el 4 de Sept. de 2023
0 votos
1 comentario
Aiswarya
el 5 de Sept. de 2023
Yes, the function odefun is a function handle to which you are passing the values of t and y0. It's better to give f directly as expression in the dydt expression. The inputs which can be given to the odefun are timespan, y0 (initial conditions) and some other options, which you can find in the documentation :
Categorías
Más información sobre 常微分方程式 en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!