how to draw surface

3 次查看(过去 30 天)
Beyza Taka
Beyza Taka 2020-5-7
how do I write the program that draws the two-dimensional integral surface of the function in Matlab ?

采纳的回答

Ameer Hamza
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
  9 个评论
Ameer Hamza
Ameer Hamza 2020-5-8
I am glad to be of help.
Ameer Hamza
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 CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by