??? Undefined function or variable 'ODE45_main'.

5 Ansichten (letzte 30 Tage)
Lan
Lan am 13 Mär. 2015
Bearbeitet: John D'Errico am 13 Mär. 2015
A case of matlab :
ODE45_fun.m function dy=ODE45_fun(t,y) a=1;b=1;c=9;
dy(1)=-a*y(1)+y(3)*y(2); dy(2)=-b*(y(1)+y(3)); dy(3)=c*y(2)-y(3)-3*y(2)*y(1);
dx=[dx(1);dx(2);dx(3)];
and ODE45_main.m
tspan=[0,100]; y0=[0;0;10^(-10)]; [t,y]=ode45('ODE45_fun',tspan,y0); data=[t,y]; save ODE45_data.txt data-ascii plot3(y(:,1),y(:,2),y(:,2)) grid on title('Lorenz 方程')
>> ODE45_main
Now: ??? Undefined function or variable 'ODE45_main'.

Akzeptierte Antwort

John D'Errico
John D'Errico am 13 Mär. 2015
Bearbeitet: John D'Errico am 13 Mär. 2015
The obvious questions apply here.
1. Did you save it as an m-file?
2. On your search path?
3. Where on your search path?
Please do this:
which ODE45_main
Note that too often, the answer to the last question is the person has saved the function into the MATLAB directories. Bad idea.

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB 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