请教个问题。Vectors must be the same lengths
程序片断是for j=1:100
。。。。。
z1(1,j)=z(1);
z1(2,j)=z(2);
z1(3,j)=z(3);
end
j=1:100
plot(j,z(1,:));
运行提示??? Error using ==> plot
Vectors must be the same lengths.
请问各位,这是怎么回事啊?怎么修改
%跟踪微分
function obj_eso()
u=1;
r=0.1;
h=0.01;
x=[0,0];
for i=1:100
x(3)=x(1)+h*x(2);
b=10*sign(sin(0.5*i))+1;
x(1)=x(3);
x(2)=x(2)+h*b;
x(1,i)=x(1);
x(2,i)=x(2);
end
i=1:100
%plot(i,x(1,:));
y=x(1,:);
z=[0,0,0];
bet=[100,200,300];
b=0;
d=0.1;
for j=1:100
b1=z(2)-bet(1)*x(1);
b2=z(3)-bet(2)*x(2);
z(1)=z(1)+h*b1;
z(2)=z(2)+h*b2;
z1(1,j)=z(1);
z1(2,j)=z(2);
end
j=1:100
plot(j,z(1,:));
这是源代码,大家给我看看吧