3D plotting of five inequalities

9 views (last 30 days)
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

Accepted Answer

Massimo Zanetti
Massimo Zanetti on 23 Sep 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

More Answers (0)

Community Treasure Hunt

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

Start Hunting!