How can I declare an implicit variable, y(t), after I have used it in a symbolically defined function?

2 views (last 30 days)
I'm writing a scheme that solves an ODE and in doing so I declare a symbolic function:
syms t y(t)
f = t^(-2) * (sin(2*t) - 2*t*y)
At one point I have to take a total derivative, so I need to be be implicit in the expression, but I also need to evalute at a specific value of t and y. I attempt to do this in the following lines.
y(t) = wi;
out(1) = f(ti);
However, I am prompted with the following error.
The following error occurred converting from sym to double:
Unable to convert expression containing remaining symbolic
function calls into double array. Argument must be
expression that evaluates to number.
Error in DiffEq_alt (line 13)
out(1) = f(ti);
Ultimately, I need to be able to be able to declare y explicitly, but also treat it implicitly for when I differentiate the function with respect to t.

Answers (0)


Find more on Symbolic Math Toolbox 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!