3D plotting of five inequalities

12 ビュー (過去 30 日間)
Matthew Morrison
Matthew Morrison 2016 年 8 月 3 日
回答済み: Massimo Zanetti 2016 年 9 月 23 日
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

採用された回答

Massimo Zanetti
Massimo Zanetti 2016 年 9 月 23 日
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 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by