Funtion

cylinder radius = 15in
cylindrical middle section is 40in
Use the function to make a plot of the volume as a function of h for 0< h <70 in
here is what I did:
function V = Volfuel( h )
%This function calculates the volume of a tank shaped
%like a rectangular cylinder with hemispheric end caps
r=15;
V=4/3*pi*r^3+pi*r^2*h;
plot(h,V)
xlabel('height in inches'), ylabel('Volume of tank')
end

4 comentarios

Wayne King
Wayne King el 23 de Nov. de 2011
Hi Bobby, please format your code. What exactly is your question?
Walter Roberson
Walter Roberson el 23 de Nov. de 2011
You forgot to add your question ?
Bobby
Bobby el 23 de Nov. de 2011
Write a user-defined function (for the function name and arguments use V=Volfuel(h)) that gives the volume of fuel in the tank(in gallons) as a fuction of the height h(measured from the bottom).
Wayne King
Wayne King el 23 de Nov. de 2011
Bobby, This is not a question. Walter is giving you the opportunity to articulate a question about your homework assignment and which part of that assignment you are having difficulty with. This newsgroup is not just a homework solution forum. People here are very helpful if you show your code, which you have done, and then tell where you are getting stuck.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Programming en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 23 de Nov. de 2011

Community Treasure Hunt

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

Start Hunting!

Translated by