Page 1 of 1

Simple drawing in Matlab

Posted: Wed Oct 06, 2004 12:43 am
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) ?

Simple drawing in Matlab

Posted: Wed Oct 06, 2004 12:58 am
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!

Simple drawing in Matlab

Posted: Wed Oct 06, 2004 1:25 am
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

Simple drawing in Matlab

Posted: Wed Oct 06, 2004 2:11 am
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.

Simple drawing in Matlab

Posted: Wed Oct 06, 2004 2:19 am
by asd
Wow! OptTrader, Thanks very much for the neat trick! It worked. Smiley



 



Regards

Simple drawing in Matlab

Posted: Wed Oct 06, 2004 2:21 am
by opmtrader
No prob dude. Take care.