create a three-dimensional surface plot
4 次查看(过去 30 天)
显示 更早的评论
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,
0 个评论
采纳的回答
Star Strider
2020-12-18
Use element-wise operations for exponentiation (.^) and division (./):
z = ((x.^2)./(1+(x.^2))) + y.^2;
Then, it works.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!