Effacer les filtres
Effacer les filtres

How to use the "Input" command-- specific problem help

3 vues (au cours des 30 derniers jours)
Jay
Jay le 2 Fév 2014
Commenté : Walter Roberson le 2 Fév 2014
I don't understand how to do the input command.. can someone help me?
The figure attached shows a cylindrical tank of height H and radius r, with a spherical cap on each end (also of radius r). The height of the liquid in the tank is h. Use the input command to obtain values for H, r & h and compute the volume of liquid in the tank.
The calculation of the volume of liquid in the tank depends upon the relationship between h, H and r:
• If h is less than r, we need the volume of a partially-filled sphere
• If h is greater than r but less than H-r, we need the volume of a fully- filed hemisphere plus the volume of a cylinder of height h-r
• If h is greater than H-r, we need the volume of a fully-filled sphere, plus the volume of a cylinder of height H-2r, minus the partially empty upper hemisphere of height H-h
• If h is greater than H, the function should generate an error message (using error)

Réponses (1)

Amit
Amit le 2 Fév 2014
The input command ask for a value from the user, for example
A = input('Enter value for h: ')
will show on command prompt:
Enter value for h:
Where the user will provide the value and that value will be store in the variable, here A.
For more about input, type on command prompt
help input

Catégories

En savoir plus sur 3-D Volumetric Image Processing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by