How to plot this in MATLAB
Afficher commentaires plus anciens
Hi,
How to plot the following inequality in MATLAB in 3D:
Ax<=b
where A is an m-by-n matrix, x is an n-by-1 vector, and b is an m-by-1 vector??
Thanks in advance
6 commentaires
Andrew Newell
le 5 Avr 2011
What variables do you want on the axes?
S. David
le 5 Avr 2011
Andrew Newell
le 5 Avr 2011
Oh, so you really want to plot the surface of the polyhedron?
Walter Roberson
le 5 Avr 2011
What exactly is to be plotted? In how many dimensions?
Andrew Newell
le 5 Avr 2011
How many dimensions are involved? It's very hard to visualize greater than 3 dimensions.
S. David
le 5 Avr 2011
Réponses (3)
the cyclist
le 5 Avr 2011
0 votes
A clever way to do this might be to use the "convhull" command, if you can generate a dataset that obeys that relationship.
1 commentaire
S. David
le 5 Avr 2011
Sean de Wolski
le 5 Avr 2011
0 votes
Some useful reading for you.
1 commentaire
S. David
le 5 Avr 2011
the cyclist
le 6 Avr 2011
I sat down and thought about this more carefully, and I think the question is a little ambiguous, in a couple different ways.
Let's look at the simplest possible example:
A = eye(2);
b = ones(2,1);
First, it is not perfectly clear what is meant by Ax<=b, because that is the comparison of two vectors, and there is no less than or greater than relationship between them. For example, if Ax = [2; 3] and b=[3; 2], then does the inequality hold?
Maybe it means, though, that every element of Ax must be less than b. If that is the case, then I guess we want to find the boundary. This is solution to A*x=b. (Note that this is now a strict equality now.) I have not done real matrix algebra in a while, but I believe the best way to do this in MATLAB is
x_boundary = A\b
which means in our simple case that x_boundary = [1;1].
So, it seems you want a plot of the region where x <= x_boundary. That's a semi-infinite region, methinks. Not sure how you want to plot that.
Hope that helps a little. It's been a while since I've thought about this type of math, so be sure to do your own thinking on this and see if it makes sense.
1 commentaire
S. David
le 7 Avr 2011
Catégories
En savoir plus sur 2-D and 3-D Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!