フィルターのクリア

Solve first ode using ode45

1 回表示 (過去 30 日間)
Lim Xiao Hui
Lim Xiao Hui 2021 年 6 月 9 日
コメント済み: Lim Xiao Hui 2021 年 6 月 9 日
Hello, my question is i have first ode dT/dt = -0.0004*[T(t) - 5], may i know how to use ode45 to solve t in the range T [8 88]? Can i know how about the script? Thank you for your help.

回答 (2 件)

Walter Roberson
Walter Roberson 2021 年 6 月 9 日
format long g
syms T(t) T8
dTdt = diff(T(t),t)
dTdt = 
eqn = dTdt == -0.0004*(T - 5)
eqn(t) = 
init = T(8) == T8
init = 
sol = simplify(dsolve([eqn, init]))
sol = 
Specific_T8 = 6
Specific_T8 =
6
Tsol = subs(sol, T8, Specific_T8)
Tsol = 
fplot(Tsol, [8 88])
  1 件のコメント
Lim Xiao Hui
Lim Xiao Hui 2021 年 6 月 9 日
thank you

サインインしてコメントする。


Jan
Jan 2021 年 6 月 9 日
編集済み: Jan 2021 年 6 月 9 日
You can modify the examples of the documentation easily, see: doc ode45
Temperature0 = 6.2; % Your initial value
[Time, Temperatur] = ode45(@fcn, [8, 88], Temperature0)
plot(Time, Temperature);
function dT = fcn(Time, Temperature)
dT = -0.0004 * (Temperatur - 5);
end
  1 件のコメント
Lim Xiao Hui
Lim Xiao Hui 2021 年 6 月 9 日
thank you

サインインしてコメントする。

カテゴリ

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