
Plotting an exponential exp(-x), in 3D?
10 次查看(过去 30 天)
显示 更早的评论
Hi, I want to plot exp(-x) which is e^-x, and revolve it around x=-5 in order to get a 3D solid that looks like a cooling tower of nuclear power plants. However the limit of y values should be from 1 to 200 which the height of the tower. How can I do that? 

Thanks!
0 个评论
采纳的回答
Star Strider
2020-6-14
Try this:
r = linspace(0.5, 5, 50);
a = linspace(0, 2*pi, 60);
[R,A] = ndgrid(r,a);
Z = exp(-R);
[X,Y,Z] = pol2cart(A,R,Z);
figure
mesh(X, Y, Z)
grid on
producing:

.Experiment to get it to look the way you want it to look.
16 个评论
更多回答(1 个)
Ameer Hamza
2020-6-14
exp(-x) does not seem to be a good function for this. Try following code
[X, Y] = meshgrid(-1:0.01:1);
XY = sqrt(X.^2 + Y.^2);
Z = 1./XY;
surf(X, Y, Z)
zlim([0 10])
caxis([0 10])
shading interp

另请参阅
类别
在 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!

