帮忙看看一个小的Matlab程序的错误****
来源:百度知道 编辑:UC知道 时间:2024/05/17 13:41:04
代码是这样的:
function xdot=shier(t,x)
r=1;d=0.5;a=0.1;b=0.02;
x0=[25,2];
xdot=[(r-a*x(2)).*x(1);(-d+b*x(1)).*x(2)];
ts=0:0.1:15;
x0=[25,2];
[t,x]=ode45('shier',ts,x0);[t,x],
plot(t,x),grid,gtext('x(t)'),gtext('y(t)'),
pause,
plot(x(:,1),x(:,2)),grid,
错误是:
??? Input argument 'x' is undefined.
Error in ==> d:\MATLAB6p5p1\work\a.m
On line 4 ==> xdot=[(r-a*x(2)).*x(1);(-d+b*x(1)).*x(2)];
请看看!急!!!
function xdot=shier(t,x)
r=1;d=0.5;a=0.1;b=0.02;
x0=[25,2];
xdot=[(r-a*x(2)).*x(1);(-d+b*x(1)).*x(2)];
ts=0:0.1:15;
x0=[25,2];
[t,x]=ode45('shier',ts,x0);[t,x],
plot(t,x),grid,gtext('x(t)'),gtext('y(t)'),
pause,
plot(x(:,1),x(:,2)),grid,
错误是:
??? Input argument 'x' is undefined.
Error in ==> d:\MATLAB6p5p1\work\a.m
On line 4 ==> xdot=[(r-a*x(2)).*x(1);(-d+b*x(1)).*x(2)];
请看看!急!!!
这次看看:
function hhh
ts=0:0.1:15;
x0=[25,2];
[t,x]=ode45(@shier,ts,x0);
[t,x],
plot(t,x),grid,gtext('x(t)'),gtext('y(t)'),
pause,
plot(x(:,1),x(:,2)),grid,
function xdot=shier(t,x)
r=1;d=0.5;a=0.1;b=0.02;
xdot=[(r-a*x(2)).*x(1);(-d+b*x(1)).*x(2)];