
matlab:i=1:700 ,x(i),y(i)已经求出。 想用plot函数在同一副图中画出所有0,0和x(i),y(i)的连线。
1个回答
展开全部
%从原点至指定点,两点间画线
clear all;clc;
%%%%%%%%%%%%%%%%%% start
x = [0 0];
y=input('please input your data:');%如果是700个点,你可以先读到y这个矩阵里,程序不变
z=[x;y];
figure('Name','Point-Line');
hold on;
%plot point
plot(z(:,1),z(:,2),'r*');
% plot line
for n = 1
for m = (n+1):length(z)
plot(z([n,m],1),z([n,m],2),'b-');
end
end
我给了实例作出的图。输入[1 1;3 2]就是这个效果
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询