Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 工程数学软件 > MATLAB论坛
MATLAB论坛 一切MATLAB相关问题在此讨论。
回复
 
主题工具 显示模式
旧 2013-04-07, 12:56   #1
张小北
初级会员
 
注册日期: 2013-04-07
年龄: 34
帖子: 1
声望力: 0
张小北 正向着好的方向发展
默认 各位高手,小弟有一个小程序一直泡不下来,求各位大神帮忙,先谢过了

function xiaobei()
%clc
%clear all
global a
yyy_fcn=@Newyfun;
fcn_integrator=@ode45;
w=1;
% y0=[0;0;0.2;0.2];
% tspan=0:2*pi/w*0.01:2*pi/w*110;
tt=2*pi/w;
% options = odeset('RelTol',1e-6,'AbsTol',[1e-6 1e-6]);
% options = odeset('RelTol',1e-6,'AbsTol',[1e-6 1e-6]);
% options = odeset('RelTol',1e-6,'AbsTol',[1e-6 1e-6]);
% options = odeset('RelTol',1e-6,'AbsTol',[1e-6 1e-6]);
for a=0.0001:0.0001:1
y0=[0.00001;0.00001;0.2;0.2];
for i=2:100
tspan=(i-1)*tt:tt/100:tt*i;
[t,y]=feval(fcn_integrator,yyy_fcn,tspan,y0);
y0=y(end,';
if i>=60
plot(f,y(end,4),'k.','markersize',1);
hold on
end
end
end
figure(2)
plot(y(:,2),y(:,4));


%调用方程的函数

function dx=NewyFun(x)
global a
m1=1;m2=0.3;k1=1;k2=1;c1=0.3;c2=0.4;u1=1;u2=1;l=1;f=80;
dx=[x(1);
x(2);
(l-a)*(l-a)*(f-k1*x(1)-c1*x(3)-u1*x(1)*x(1)*x(1))/(m2*a*a+m1*(l-a)*(l-a))-a*(l-a)*(k2*x(2)+c2*x(4)+u2*x(2)*x(2)*x(2))/(m2*a*a+m1*(l-a)*(l-a));
a*(l-a)*(f-k1*x(1)-c1*x(3)-u1*x(1)*x(1)*x(1))/(m2*a*a+m1*(l-a)*(l-a))-a*a*(k2*x(2)+c2*x(4)+u2*x(2)*x(2)*x(2))*dt/(m2*a*a+m1*(l-a)*(l-a))+x4;];
end

运行后报错显示;
Error using ==> NewyFun
Too many input arguments.

Error in ==> odearguments at 110
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.

Error in ==> ode45 at 173
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...

Error in ==> xiaobei at 19
[t,y]=feval(fcn_integrator,yyy_fcn,tspan,y0);

请问哪里有问题,谢过了!
张小北 当前离线   回复时引用此帖
回复


发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛启用 表情符号
论坛启用 [IMG] 代码
论坛禁用 HTML 代码



所有时间均为北京时间。现在的时间是 14:46


Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.