How to solve a differential equations?

>> syms t y
>> a= t.*y+t.^2.*sin(t);
>> ydiff=@(t,y) a
ydiff =
@(t,y)a
I want differential equations in place of a.
what should i do?

Answers (2)

syms t y(t)
a = diff(y) == t.*y+t.^2.*sin(t);
av = odeToVectorField(a)
a_fcn = matlabFunction(av, 'Vars',{t,Y})
You can then use ‘a_fcn’ with the MATLAB numerical ODE solvers.

Products

Release

R2018a

Asked:

on 1 Dec 2018

Answered:

on 1 Dec 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!