フィルターのクリア

How to plot a special plane x-y=5 with surf function

4 ビュー (過去 30 日間)
Wei Wei
Wei Wei 2022 年 7 月 20 日
回答済み: Sam Chak 2022 年 7 月 20 日
Hi there! I am trying to plot special planes such as "x-y=5" and "z=2x" in which one dimension is missing using surf function. I am really confused here. Does anyone have a clue? Many thanks!

回答 (2 件)

Chunru
Chunru 2022 年 7 月 20 日
x = (-10:10)';
y = x - 5;
z = [-10 10]';
nz = length(z);
xx = x*ones(1, nz);
yy = y*ones(1, nz);
zz = ones(length(x), 1) * z';
surf(xx, yy, zz)

Sam Chak
Sam Chak 2022 年 7 月 20 日
HI @Wei Wei, not exactly sure about the "special" thing. Do you expect something like this?
[X, Y] = meshgrid(-1:2/40:1, -5:5/40:0);
Z1 = X - Y - 5;
surf(X, Y, Z1), hold on
Z2 = 2*X;
surf(X, Y, Z2)
xlabel('x'), ylabel('y'), zlabel('z')

カテゴリ

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

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by