フィルターのクリア

create a three-dimensional surface plot

1 回表示 (過去 30 日間)
Hidd_1
Hidd_1 2020 年 12 月 18 日
回答済み: Star Strider 2020 年 12 月 18 日
Hello everybody!
I want to create a three-dimensional surface plot using the function surf, but unfortanatley there is a bug in my code which i coudn't solve or understand.
I would be greatful for any help!
Here is the code:
creates a three-dimensional surface plot:
[x,y] = meshgrid(1:0.5:10,1:20);
z = ((x^2)/(1+(x^2))) + y^2;
xlabel(x)
ylabel(y)
zlabel(z)
surf(x,y,z)
the function is the following
Thnak you very much in advance!
Best regards,

採用された回答

Star Strider
Star Strider 2020 年 12 月 18 日
Use element-wise operations for exponentiation (.^) and division (./):
z = ((x.^2)./(1+(x.^2))) + y.^2;
Then, it works.
See Array vs. Matrix Operations for details.

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by