% % 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('yossi'); % c=50; d=10; len=50; % length % x(1)=c; x(2)=x(1)+len/2; x(3)=x(2)-len; x(4)=x(1); %-------------------- y(1)=d; y(2)=y(1)+len*sin(pi/3); y(3)=y(2); y(4)=y(1); % % for j=1:3 line([x(j) x(j+1)],[y(j) y(j+1)]); text(x(j),y(j),num2str(j)); end % i a=50; b=70; len=50; % length % x(1)=a; x(2)=x(1)-len/2; x(3)=x(2)+len; x(4)=x(1); %-------------------- y(1)=b; y(2)=y(1)-len*sin(pi/3); y(3)=y(2); 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