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 y(t) to be be implicit in the expression, but I also need to evaluate f(t,y) 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 f(t,y(t)) with respect to t.
Note: This exact question was also posted on MathWorks.