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

조회 수: 6 (최근 30일)
Jay
Jay 2014년 2월 2일
댓글: Walter Roberson 2014년 2월 2일
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)

답변 (1개)

Amit
Amit 2014년 2월 2일
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

카테고리

Help CenterFile Exchange에서 Biological Physics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by