Execution of script ode45 as a function is not supported ... Error in pop (line 12) [a,b] = ode45(@ypr​ime,[0,tfi​n],pinit);

조회 수: 69 (최근 30일)
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개)

Steven Lord
Steven Lord 2021년 10월 5일
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
/MATLAB/toolbox/matlab/funfun/ode45.m /MATLAB/toolbox/nnet/deep/@dlarray/ode45.m % Shadowed dlarray method
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.

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by