![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/291307/image.png)
how to draw surface
2 次查看(过去 30 天)
显示 更早的评论
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/291290/image.png)
0 个评论
采纳的回答
Ameer Hamza
2020-5-8
编辑:Ameer Hamza
2020-5-8
You can draw it using meshgrid and surf
[X, Y] = meshgrid(linspace(-3,3));
Z = exp(-X.^2-Y.^2);
surf(X,Y,Z)
shading interp
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/291307/image.png)
9 个评论
Ameer Hamza
2020-5-8
FYI, this is a faster version of the previous code in the comment
syms x y X Y
fun = matlabFunction(int(int(z,x,0,X),y,0,Y), 'Var', {X, Y});
[Xg, Yg] = meshgrid(linspace(0,2));
Z = arrayfun(fun, Xg, Yg);
surf(Xg,Yg,Z)
shading interp
更多回答(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!