# Plotting an exponential exp(-x), in 3D?

38 views (last 30 days)
Ibrokhimbek Odinaev on 14 Jun 2020
Commented: Star Strider on 19 Jun 2020
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!

Star Strider on 14 Jun 2020
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.

Star Strider on 19 Jun 2020
Try this:
figure % Create Figure Window
mesh(X, Y, Z, 'FaceAlpha',0.2) % Create ‘mesh’ Plot Of 3D Cooling Tower
hold on % More Plots On Same Axes: On
zlvl = [100; 150; 200]; % Z-Levels For Disks
for k = 1:numel(zlvl)
zht = find(hval*exp(-r*sval)<=zlvl(k),1,'first'); % Z-Level Closest Index
patch(X(zht,:), Y(zht,:), Z(zht,:), 'r') % Draw Disk
end
plot3(X(1,:), Y(1,:), Z(1,:), 'k') % Top Circle
plot3(X(end,:), Y(end,:), Z(end,:), 'k') % Base Circle
hold off % More Plots On Same Axes: Off
grid on % Create Grid Lines On All Axes
view(90,10) % Define Camera Position
Experiment to get the result you want.
.
Ibrokhimbek Odinaev on 19 Jun 2020
Perfect! Thank you very much!🙌
Star Strider on 19 Jun 2020
As always, my pleasure!

Ameer Hamza on 14 Jun 2020
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])

#### 1 Comment

Ibrokhimbek Odinaev on 14 Jun 2020
I am doing a project, I have to use exp(-x), plus there shouldn't be th down surface it should be just a solid. Is there any other options?