How to plot a surface curve with inequalities?

7 ビュー (過去 30 日間)
Aditya Zade
Aditya Zade 2023 年 5 月 30 日
コメント済み: Aditya Zade 2023 年 5 月 30 日
M = 0.85 : 1/200 : 1 ;
Psi = 0 : 1/200 : 30 ;
dp = 0.6 : 1/200 : 1 ;
[ X, Y, Z ] = meshgrid( dp, Psi, M ) ;
ineq = ( X > 1 - ( 4 * Y / 360 ) ) & ( X > (2/pi)*asin(Z/2) ) & ( X < (2/pi)*asin(Z) ) ;

採用された回答

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023 年 5 月 30 日
Note that 1st of all, in order to compare X vs. Y vs. Z, their size "MUST" match. Therefore, to make their size compatible, e.g. 200.
Here is one of the possible solutions of this exercise:
N = 200;
M = linspace(0.85 ,1, N) ;
Psi = linspace(0,30, N) ;
dp = linspace(0.6,1, N) ;
[ X, Y] = meshgrid(dp, Psi) ;
[~, ZZ] = meshgrid(M, M);
IND = ( X > 1 - ( 4 * Y / 360 )) & ( X > (2/pi)*asin(ZZ/2) ) & ( X < (2/pi)*asin(ZZ)) ;
Xs = X.*(IND);
Ys = Y.*(IND);
Zs = ZZ.*(IND);
meshc(Xs, Ys, Zs)
xlabel('dp')
ylabel('psi')
zlabel('M')
Check your specified inequality conditions whether they are correct or not.
  1 件のコメント
Aditya Zade
Aditya Zade 2023 年 5 月 30 日
Thanks for the answer. But it seems the shape of the plot is wrong. The inequalities are correct in your script. For your reference, the plot drawn by John is correct. The plot should only be valid between M = 0.87 to 1.

サインインしてコメントする。

その他の回答 (1 件)

John D'Errico
John D'Errico 2023 年 5 月 30 日
編集済み: John D'Errico 2023 年 5 月 30 日
And exactly what is the problem? I think what you do not understand is, what you have created is NOT a surface.
M = 0.85 : 1/200 : 1 ;
Psi = 0 : 1/200 : 30 ;
dp = 0.6 : 1/200 : 1 ;
[ X, Y, Z ] = meshgrid( dp, Psi, M ) ;
ineq = ( X > 1 - ( 4 * Y / 360 ) ) & ( X > (2/pi)*asin(Z/2) ) & ( X < (2/pi)*asin(Z) );
X(~ineq) = NaN;
Y(~ineq) = NaN;
Z(~ineq) = NaN;
plot3(X(:),Y(:),Z(:),'.')
The result is a set of points that live in a triangular region in X and Y, with one curved surface, where Z is a function of X and Y.
But there is no "surface" that you have created. You might think of what you have done is to create a volume, the set of points delineated by those constraints.
  1 件のコメント
Aditya Zade
Aditya Zade 2023 年 5 月 30 日
編集済み: Aditya Zade 2023 年 5 月 30 日
Hi John,
The problem here is its hard to understand the shape of the 3d set of points. Is there a way to have boundaries or change of color of the set of points as the value of M (Z axis) increases? Something similar to what we have in a surface plot.

サインインしてコメントする。

カテゴリ

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