- #1
LakeMountD
- 59
- 0
for r = 2:.1:10
h=(500/(pi*r^2))-(2*r); %Height for given r assuming max volume of 500m^3
a=2*pi*r*h; %Surface area for cylindrical part
b=2*pi*r^2; %Surface area for hemispherical top
t=a*300+b*400; %Total cost using values of surface area
plot(r,t,'r-+');
end
I am just trying to get it to plot each r value against its respective cost (t value) but it only gives me one point on the graph. Why won't it create a string of points?
h=(500/(pi*r^2))-(2*r); %Height for given r assuming max volume of 500m^3
a=2*pi*r*h; %Surface area for cylindrical part
b=2*pi*r^2; %Surface area for hemispherical top
t=a*300+b*400; %Total cost using values of surface area
plot(r,t,'r-+');
end
I am just trying to get it to plot each r value against its respective cost (t value) but it only gives me one point on the graph. Why won't it create a string of points?