回 帖 发 新 帖 刷新版面

主题:ode45调用出错

clear all;
close all;
double t;
[t,y]=ode45('eq',[0:0.01:50],[0.5,0.6,0.9]);
plot3(y(:,1),y(:,2),y(:,3));


上述主程序调用下面的函数:
function dx=eq(t,x,flag)
p1=1;
p2=10;
p3=4;
dx=[p1*x(1)-x(2)*x(3);
   -p2*x(2)+x(1)*x(3);
   -p3*x(3)+x(1)*x(2)];
结果提醒:Mixture of single and double data for 't0', 'y0', and 'f(t0,y0)' in call to ode45.
谁能给解释一下出了什么问题?

回复列表 (共3个回复)

沙发

改为:clear all;
close all;
double t;
[t,y]=ode45('eq',[0:0.01:50],[0.5,0.6,0.9]);
plot3(y(:,1),y(:,2),y(:,3));


function dx=eq(t)
p1=1;
p2=10;
p3=4;
dx=[p1*x(1)-x(2)*x(3);
   -p2*x(2)+x(1)*x(3);
   -p3*x(3)+x(1)*x(2)];

板凳

不好意思 

上贴 错误

3 楼

Warning: Mixture of single and double data for 't0', 'y0', and 'f(t0,y0)' in call to ode45.

我运行了一个简单题目,结果出来了 也有这句话

所以  不用管它

有结果就行

我来回复

您尚未登录,请登录后再回复。点此登录或注册