% % triangle.m Demonstrating the loop and % graphics interaction % h=figure; set(gcf,'DefaultTextColor','red'); v=get(h); c=[0 100 100 0 0]; d=[0 0 100 100 0]; plot(c,d, 'g-'); title('First loop test'); % a=10; b=10; len=80; % length % x(1)=a; x(2)=x(1)+len; x(3)=x(2)-len/2.; x(4)=x(1); %-------------------- y(1)=b; y(2)=y(1); y(3)=y(2)+len*sin(pi/3); y(4)=y(1); % for i=1:3 line([x(i) x(i+1)],[y(i) y(i+1)]); text(x(i),y(i),num2str(i)); end % i