Solve first ode using ode45
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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.
0 commentaires
Réponses (2)
Walter Roberson
le 9 Juin 2021
format long g
syms T(t) T8
dTdt = diff(T(t),t)
eqn = dTdt == -0.0004*(T - 5)
init = T(8) == T8
sol = simplify(dsolve([eqn, init]))
Specific_T8 = 6
Tsol = subs(sol, T8, Specific_T8)
fplot(Tsol, [8 88])
Jan
le 9 Juin 2021
Modifié(e) : Jan
le 9 Juin 2021
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
Voir également
Catégories
En savoir plus sur Ordinary Differential Equations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!