Surf command to plot simple surface

2 ビュー (過去 30 日間)
Bobby Fischer
Bobby Fischer 2021 年 10 月 2 日
編集済み: Ravi Narasimhan 2021 年 10 月 2 日
Hi
what is happening here:
close all
x = -1 : 0.1 : 5;
y = x;
[X, Y] = meshgrid(x,y);
Z = 2*X - X*Y + 2*Y;
surf(X, Y, Z)
xlabel('Ox')
ylabel('Oy')
zlabel('Oz')

採用された回答

Ravi Narasimhan
Ravi Narasimhan 2021 年 10 月 2 日
編集済み: Ravi Narasimhan 2021 年 10 月 2 日
Did you intend to do an element-by-element multiply on X and Y?
close all
x = -1 : 0.1 : 5;
y = x;
[X, Y] = meshgrid(x,y);
Z = 2*X - X.*Y + 2*Y; % Note the .*
surf(X, Y, Z)
xlabel('Ox')
ylabel('Oy')
zlabel('Oz')

その他の回答 (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