How to say that a constant is not a variable?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Quentin Dragomir
le 1 Juin 2018
Commenté : Quentin Dragomir
le 2 Juin 2018
Hi,
I would like to solve an ode in a analytic way
So i do:
df= @(,) ...
syms T(t)
df1=sym(df);
y0=10 % a constant
f_exact = matlabFunction(dsolve(diff(T,1) == df1 , T(0)== y0));
If I run that i am getting f_exact=@(t,y0) ... % function of t and y0
How wan i do to say that y0 is a constant
Thank you
2 commentaires
Réponse acceptée
Walter Roberson
le 1 Juin 2018
When you do
df = @(t,T) -0.1*(T -10);
then the T is taken from the second argument of df, not from the syms T(t). When you sym(df) then the T that appears in the result is a different T, not the same one as syms T(t) .
Instead of using
df1 = sym(df)
you should be using
syms T(t)
df1 = df(t,T)
Plus de réponses (0)
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!