### Tags: article, drawing, lab, math, matlab, programming, square

# Drawing a 2d square in math lab

On Programmer » Matlab

1,288 words with 0 Comments; publish: Mon, 28 Apr 2008 17:40:00 GMT; (20046.88, « »)

In article <a8386a05-3dce-40c7-80ce-4a1e94f211b6.matlab.todaysummary.com.c30g2000hsa.googlegroups.co

m>,

<sbose27.matlab.todaysummary.com.gmail.com> wrote:

>I'm trying to render a square object in math lab using matrix values

>and am unsure on how to go about this. Is there a specific command to

>draw this easily using matrix values. For example:

>A = [-1 -1 1 1; -1 1 1 -1]

> -1 -1 1 1

> -1 1 1 -1

>Is there a command to map each vector as a corner point for a square

>in a graph.

If you only have the four points, then you will need to use patch().

If you close the square yourself (repeat the original point at the

end so it knows to draw back to the origin) then you can use plot()

or line().

> If this square can be generated is there a way to view

>multiple squares in the same graph?

Yes. patch() and line() do not erase the current plot. plot()

allows you to list several coordinate lists in the same call, and

you can always use 'hold on' and make several plot() calls.

--

"Okay, buzzwords only. Two syllables, tops." -- Laurie Anderson

*http://matlab.todaysummary.com/q_matlab_14333.html*

All Comments

Leave a comment...

- 0 Comments