calculate and plot the following differential equation using ODE45solver.

I would loke to calculate and plot the following differential equation using ODEsolver.
But I get error.
Please take care of me.
I want to know who understands
y'(t)=-y(t)+sin(t)
y0=0.5; %intial value
h=0.8; %
t=0:0.8:4; %tspan
script
[t,y] =ode45(@-y(t)+sin(t), t,y0);error
plot(t,y,'-o');
xlabel('time');
ylabel('y');

 Respuesta aceptada

Stephan
Stephan el 16 de Jun. de 2020
Editada: Stephan el 16 de Jun. de 2020
y0=0.5; %intial value
h=0.8; %
t=[0 4]; %tspan
[t,y] =ode45(@(t,y)-y+sin(t), t,y0);
plot(t,y,'-o');
xlabel('time');
ylabel('y');

Más respuestas (0)

Preguntada:

sz
el 16 de Jun. de 2020

Editada:

el 16 de Jun. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by