I want to use the 2d plot([x1,x2,x3,x1],[y1,y2,y3,y1]) to draw a triangle in my plot image. But how do I define the borders? the Diagram should not start on the motleft point and so forth but for example on the point of origin or any other point I like to use. Also it should end where I want. How to do that?
here the full code:
xs = [0,10,20,0];
ys = [30,50,30,30];
plot(xs,asinh(tan(ys*pi/180)));
the result I wanted:
xs = [0,10,20,0];
ys = [30,50,30,30];
plot(xs,(asinh(tan(ys*pi/180))*180/pi));
xlim([-10 30])
ylim([-10 60])
I’m not sure I understand your question. If you want to set the limits of the axes of your plot so that you can place your triangle anywhere within the plot:
Try
xlim([xmin, xmax])andylim([ymin, ymax])after you run theplotcommand: see http://www.mathworks.com/help/techdoc/ref/xlim.htmlIf you want to know how to draw a triangle by plotting points and connecting the points:
Try simply ordering x1, x2,x3 etc in the order in which you want to connect the dots and run
plotso that it plots lines (which I believe it does by default). But to be explicit you can runplot([x1,x2,x3,x1],[y1,y2,y3,y1],'b-')to make a blue line connecting the points.