Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Drawing a polyhedron by giving only the vertices

360 views
Skip to first unread message

Mahshid Ghozloocheh

unread,
Apr 30, 2012, 2:37:07 PM4/30/12
to
Hello,
I am writing a GUI for a simplex problem and I want to draw the feasible region polyhedron by just providing matlab with the vertices. Is that feasible?

Thanks.

Matt J

unread,
Apr 30, 2012, 3:14:07 PM4/30/12
to
"Mahshid Ghozloocheh" wrote in message <jnmm4i$3o7$1...@newscl01ah.mathworks.com>...
> Hello,
> I am writing a GUI for a simplex problem and I want to draw the feasible region polyhedron by just providing matlab with the vertices. Is that feasible?
==============

You can use this FEX contribution to convert re-express the polyhedron using linear inequalities:


http://www.mathworks.com/matlabcentral/fileexchange/30892-representing-polyhedral-convex-hulls-by-vertices-or-inequalities


Then you can use this second contribution to create the plot:


http://www.mathworks.com/matlabcentral/fileexchange/9261-plot-2d3d-region

Mahshid

unread,
Apr 30, 2012, 11:28:09 PM4/30/12
to
That's amazing! Thank you very much.

"Matt J" wrote in message <jnmo9v$diq$1...@newscl01ah.mathworks.com>...

Alex V

unread,
May 1, 2012, 4:11:07 AM5/1/12
to
"Mahshid" wrote in message <jnmm4i$3o7$1...@newscl01ah.mathworks.com>...
> Hello,
> I am writing a GUI for a simplex problem and I want to draw the feasible region polyhedron by just providing matlab with the vertices. Is that feasible?
>
> Thanks.

no, it's not possible, but what IS possible is to draw the polyhedron by giving matlab the vertices and info on how to connect them. like so:

verts = [1 0 0; -1 0 0; 0 1 0;0 0 1];

faces = [1 2 4;1 3 4; 2 3 4;1 2 3];

h = patch('Faces',faces,'Vertices',verts,'FaceColor','b','EdgeColor','w')

that code creates a tetrahedron from (x,y,z) vertices p1(1,0,0), p2(-1,0,0), p3(0,1,0), p4(0,0,1), in that order, and faces defined by the polygons p1,p2,p4; p1,p3,p4;... etc

http://www.mathworks.com/help/techdoc/ref/patch.html

Steven_Lord

unread,
May 1, 2012, 10:05:31 AM5/1/12
to


"Alex V" <ava...@purdue.edu> wrote in message
news:jno5qr$es7$1...@newscl01ah.mathworks.com...
To plot triangles or tetrahedra, you may want to use TRIPLOT, TRIMESH,
TRISURF, and/or TETRAMESH.

--
Steve Lord
sl...@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Alex V

unread,
May 1, 2012, 5:57:06 PM5/1/12
to
"Steven_Lord" <sl...@mathworks.com> wrote in message <jnoqjb$9na$1...@newscl01ah.mathworks.com>...
agreed, although i don't have much experience with those in particular - this was more a generic example of what he might have been looking for, for use in more varied applications
0 new messages