Execution of script ode45 as a function is not supported ... Error in pop (line 12) [a,b] = ode45(@yprime,[0,tfin],pinit);
Ältere Kommentare anzeigen
Hi how do I fix this error message? Here is the code below.Im trying to plot logistic population growth.
global a
a = 2;
global b
b = 1;
tfin = 100; %tfin is the the length of time with you are solving for (time final)
pinit = 2.4; %establishes the initial p value, p(0)
[a,b] = ode45(@yprime,[0,tfin],pinit);
figure(1);
plot(a,b);
xlabel('Time')
ylabel('Population')
title('Logistic Population Growth')
1 Kommentar
Alan Stevens
am 5 Okt. 2021
You haven't shown what your yprime function looks like.
Antworten (1)
You've written a script file ode45.m that's taking precedence over the ode45 function included in MATLAB. Check where that script file is located and rename or remove it.
which -all ode45
If you see an ode45.m that's not in the toolbox/ directory that's likely the culprit. Leave the files in either of those two locations (you may or may not have the one in toolbox/nnet) alone.
If you don't have another ode45.m then it's possible the file has been corrupted.
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!