Simple drawing in Matlab

Post Reply
User avatar
asd
Posts: 0
Joined: Thu Jan 01, 2004 12:00 am

Simple drawing in Matlab

Post by asd »

How can I make a simple triangle figure in Matlab ? (Hope I find it in Octave!)



eg., I want to plot a triangle with (x,y) co-ordinates (1,2) (5, -8 ) and (3,1) ?
User avatar
opmtrader
Posts: 0
Joined: Thu Jan 01, 2004 12:00 am

Simple drawing in Matlab

Post by opmtrader »

Can you create an array of X values (1,5,3) and Y values (2,-8,1) and then simply say plot(x,y)?



Its so funny that you mentioned that. I'm having the front of my house re-bricked. The brick layers proposed an archway arc that was based on a circle. I wanted something just a little more severe. I wanted the arch to be 1 inch higher but the width had to remain the same, thus the arc had to come from an ellipse. So I got on Matlab, plotted the circle, then played around with ellipse equations to match my constraints. When I found the one that matched I printed out the X and Y coordinates of the arch, went outside and plotted it on the frame. Now I've got what I want. Go Matlab!
User avatar
asd
Posts: 0
Joined: Thu Jan 01, 2004 12:00 am

Simple drawing in Matlab

Post by asd »

OpmTrader, thanks a lot for the tips. I tried the trick on Octave, but get the following :



[img]/beta/User%20Files/33/untitled33.jpg[/img]



 



One side is not closed. Any tips??



Thanks again
User avatar
opmtrader
Posts: 0
Joined: Thu Jan 01, 2004 12:00 am

Simple drawing in Matlab

Post by opmtrader »

Ah maybe you need to make the last point a repeat of the first point to get it to draw from point 3 to point 1.



So try X= (1,5,3,1) and Y= (2,-8,1,2)

plot(X,Y)



Let me know.
User avatar
asd
Posts: 0
Joined: Thu Jan 01, 2004 12:00 am

Simple drawing in Matlab

Post by asd »

Wow! OptTrader, Thanks very much for the neat trick! It worked. Smiley



 



Regards
User avatar
opmtrader
Posts: 0
Joined: Thu Jan 01, 2004 12:00 am

Simple drawing in Matlab

Post by opmtrader »

No prob dude. Take care.
Post Reply