Solving system of inequalities and plot in 3-dimensional

11 visualizaciones (últimos 30 días)
Sultan
Sultan el 14 de Oct. de 2019
Comentada: John D'Errico el 17 de Oct. de 2019
Hello everyone,
I would like to solve the following system of inequalities:
and then plotted (by hand) the vertices as shown in the attached figure.
I tried the functions like "plotregion", "con2vert", etc. For example :
A=[0 -1 -1; -1 -1 -1];
b= [-2 -3/2];
lb=[0 0 0];
ub= [1 1 1];
close all
plotregion(A,b,lb,ub,[0.1,0.9,0.0]);
axis equal
But I did not get the same plot. Could you please help me in plotting a similar figure.
Thanks in advance.

Respuesta aceptada

John D'Errico
John D'Errico el 14 de Oct. de 2019
Editada: John D'Errico el 14 de Oct. de 2019
Um, just because you have decided that the solution is what you plotted there, does not make it consistent with the set of inequalities you posed. So you need to tell us what you really wanted to see - the plot that you show, or the solution to the inequalities you actually wrote down.
In fact, I have no idea why you decided that pyramid drawn in your question is correct. In fact, it seimply is not so.
First, consider the pair of inequalities... We have
R1 + R2 + R3 <= 3/2
And
R2 + R3 <= 2
But as you can see, R2 and R3 are always in the interval [0,1]. So can you see that the second constraint is trivially true ALWAYS? That second constraint essentially does not even enter into the problem.
That leaves the other constraint, that the sum of the three values is no larger than 3/2. I plotted the resulting domain myself, and found that plotregion was indeed exactly correct in what it produces. (Actually, I know what that region does look like, and I know that plotregion got it right, even without redoing the plot using my own software. But I did anyway.)
Perhaps your real question is how can you produce the figure that you actually drew, which is a totally different question, as that would involve a completely different set of inequalities. Not hard to generate them, but I won't bother to do so unless I know there is a reason.
  4 comentarios
Sultan
Sultan el 15 de Oct. de 2019
Thanks John D'Errico. You helped a lot. I would like to recreate the figure. Could you please help me in that too?
John D'Errico
John D'Errico el 17 de Oct. de 2019
I might start with the inner cube. First, see that plotregion can actually do that, but it will use a random face color, and not dotted lines.
plotregion([],[],[0 0 0],[1 1 1]/2)
Simpler might be to just draw the lines themselves.
V = [0 0 0;eye(3);2*eye(3);eye(3)/2;(1-eye(3))/2;ones(1,3)/2;0 1 1];
Vx = V(:,1);
Vy = V(:,2);
Vz = V(:,3);
axind = [1 1 1;5 6 7];
line(Vx(axind),Vy(axind),Vz(axind),'linestyle','-','color','k')
axis equal
view(130,40)
cubeind = [14 14 14 11 12 13 11 12 13;11 12 13 9 10 8 10 8 9];
line(Vx(cubeind),Vy(cubeind),Vz(cubeind),'linestyle',':','color','r')
pyrind = [2 2 2 3 4;3 4 15 15 15]
line(Vx(pyrind),Vy(pyrind),Vz(pyrind),'linestyle','-','color','b')
untitled.jpg
Now use text to add whatever labels you want. I used different colors to distinguish the various lines. I think I missed a couple of lines in there, but you should get the idea.
Could you have done this with plotregion? Yes, surely so. But why bother? Your goal was to create a given figure.

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by