Maximum recursion limit error

2 Ansichten (letzte 30 Tage)
Thanuja Bandara
Thanuja Bandara am 28 Mai 2020
Bearbeitet: Ameer Hamza am 28 Mai 2020
I keep getting this maximum recursion limit error.
Maximum recursion limit of 500 reached. Use set(0,'RecursionLimit',N) to change the limit. Be aware
that exceeding your available stack space can crash MATLAB and/or your computer.
Error in ode45
I have attached my code too. Please can you help me to fix it.

Akzeptierte Antwort

Ameer Hamza
Ameer Hamza am 28 Mai 2020
Bearbeitet: Ameer Hamza am 28 Mai 2020
ode45 should be called outside the ODE function. Your actual ode function is this
function dv=Question3(t,v)
% dv/dt=8-4
dv=4;
end
and then you need to call ode45 from a separate script
to=0;
tf=100;
tspan=[to tf];
v0=0;
[t,v]=ode45(@Question3,tspan,v0);
plot(t,v(:,1));
xlabel('Time(s)');
ylabel('Volume(l)');

Weitere Antworten (0)

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by