3D plotting of five inequalities
8 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Matthew Morrison
il 3 Ago 2016
Risposto: Massimo Zanetti
il 23 Set 2016
I'm looking to make a 3D plot of the following inequalities and was wondering how to implement it:
x.*y - x - y + 1 > 0;
z < 1;
x.*y - x - y - 4.*z + 1 >0;
z.^2 - 1 > z.*(x + y - 2);
z.^4 - (x.^2 + y.^2 + 2.*x.*y - 4.*x - 4.*y + 6).*z.^2 +1 > z.^4 + (2.*x + 2.*y - .*y - 3).*z.^3 - (x.*y + 1).*z.^2 - (x.^2 + y.^2 + x.*y - 2.*x - 2.*y +1).*z + x.*y)
with them both being on the same plot. How would I go about doing this please? Or any other similar example is fine.
Thanks in advance
0 Commenti
Risposta accettata
Massimo Zanetti
il 23 Set 2016
Hi Matthew. If you are looking for the portion of 3D space where points satisfy all the inequalities at the same time, then one way can be the following. Notice that I have just considered three of the inequalities you mentioned, but you can easily add them to the piece of code.
%define the range of x,y,z coordinates
step=.5;
x=-10:step:10;
y=-10:step:10;
z=-10:step:10;
%generate a grid with all triplets (x,y,z)
[X,Y,Z] = meshgrid(x,y,z);
%intersection of inequalities in a logical matrix
I = (X.*Y-X-Y+1>0) & (Z<1) & (X.*Y-X-Y-4*Z+1>0);
%plot of the points (x,y,z) that verify all inequalities
scatter3(X(I),Y(I),Z(I),'.');
xlabel('X'); ylabel('Y'); zlabel('Z');
Is this what you need? Max
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Surface and Mesh Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!