MATLAB绘图程序错误,出现最后一点与原点连接。
Show older comments
请教下列程序哪里出了错,导致原点出现一个点。
b=10;
a=zeros(1,10);
r=zeros(1,10);
Xe=zeros(1,10);
Ye=zeros(1,10);
Xe(1)=3;Ye(1)=2;
a(1)=2;r(1)=1;
z=2;
b1=b;
m=-1;
while m<=0
a(z)=z*2;
r(z)=r(z-1)+a(z);
Xe(z)=Xe(z-1)+r(z-1);
Ye(z)=Ye(z-1)+r(z-1);
z=z+1;
if b1-r(z-1)<=0
m=1;
end
end
plot(Xe,Ye,'--');
Accepted Answer
More Answers (0)
Categories
Find more on 二维图和三维图 in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!