How to say that a constant is not a variable?
3 views (last 30 days)
Show older comments
Quentin Dragomir
on 1 Jun 2018
Commented: Quentin Dragomir
on 2 Jun 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 Comments
Accepted Answer
Walter Roberson
on 1 Jun 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)
More Answers (0)
See Also
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!