for r = 2:.1:10(adsbygoogle = window.adsbygoogle || []).push({});

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 wont it create a string of points?

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Matlab help. Can't figure out why this wont work!

**Physics Forums | Science Articles, Homework Help, Discussion**