I'm trying to use ODE15i to solve a very easy problem (y'=y with y(0)=1). since I will have more complicated relationships to deal with later. I'm not familiar with this coding language so my example can not run. I ran and there is an error saying no enough parameters is provided. How should I make it right?
That's my main code:
clearvars;
tspan=[0 1];
y0=1;
yp0=1;
options=odeset('AbsTol',1e-10);
[t,y] = ode15i(odefun_try,tspan,y0,yp0);
plot(t,y,'--blue'); title('real');
and function defined in another .m file named odefun_try.m:
function f = odefun_try(t,y,yp)
f = yp - y;
end

 Akzeptierte Antwort

Torsten
Torsten am 7 Jan. 2024
Verschoben: Dyuman Joshi am 7 Jan. 2024

0 Stimmen

[t,y] = ode15i(@odefun_try,tspan,y0,yp0);
instead of
[t,y] = ode15i(odefun_try,tspan,y0,yp0);

Weitere Antworten (0)

Kategorien

Mehr zu App Building finden Sie in Hilfe-Center und File Exchange

Produkte

Tags

Gefragt:

am 7 Jan. 2024

Verschoben:

am 7 Jan. 2024

Community Treasure Hunt

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

Start Hunting!

Translated by