MATLAB: How to say that a constant is not a variable

constantdifferential equationsodesymbolic

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

Best Answer

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)