Question: Because there are only two possibilities for conversion of temperature, its relatively easy to convert between Celsius and Fahrenheit temperature units. Because there are many

Because there are only two possibilities for conversion of temperature, its relatively easy to convert between Celsius and Fahrenheit temperature units. Because there are many more units in common use, converting between pressure units is more challenging. Here are some of the possibilities along with the number of Pascals represented by each.

Index, i Unit, Ui Description or usage #of Pa, Ci
1 psi Tire pressure, above ambient pressure 6894.76
2 atm Used for high pressure experiments 101325
3 inHg Atmospheric pressure given by weatherperson 3376.85
4 kg/cm2 Europe metric unit in situations where psi used in U.S. 98066.5
5 inH2O Used in heating/ventilating systems in buildings 248.843
6 Pa Standard SI (metric) unit of pressure, 1 N/m2 1
7 bar Frequently used by meterologists 100000
8 dyne/cm2 Older scientific pressure unit from the CGS system 0.1
9 ftH2O 2988.98
10 mmHg Used in laboratory pressure measurements 133.322
11 torr Same as 1 mmHg but used in vacuum measurement 133.322
12 ksi Used in structural engineering 6894760

The information in the table can be used to implement a conversion calculation. One way to do this is to store both the units and the corresponding number of the Pascals in individual arrays with the subscripts corresponding to each entry. For example,

U(1) = 'psi' C(1)=6894.76 U(2) = 'atm' C(2)=101325.

The conversion from one unit to another could then be computed with the following general formula:

Pd=CjCiPgPd=CjCiPg

where Pg = given pressure, Pd = desired pressure, j = the index of the desired unit, and i = the index of the given unit.

So, the conversion from one unit to another involves first determining the indices corresponding to the given and the desired units and then implementing the conversion equation. Here is a step-by-step algorithm to do this:

1. Assign the values of the unit, U, and conversion, C, arrays.

2. Have the user select the input units by entering the value of i. If the user enters a correct value within the range, 112, continue to step 3. If the user enters a value outside the range, display an error message and repeat step 2.

3. Have the user enter the given value of pressure, Pi.

4. Have the user select the desired units by entering the value of j. If the user enters a correct value within the range 112, continue to step 5. If the user enters a value outside the range, display an error message and repeat step 4.

5. Use the formula to convert the quantity in input units to its value in the desired output units.

6. Display the original quantity and units and the output quantity and units.

7. Ask if another output result for the same input is desired. If yes, go back to step 4 and continue from there. If no, go on to step 8.

8. Ask if another conversion is desired. If yes, go back to step 2 and continue from there. If no, end of algorithm.

Develop a well-structured MATLAB script using loop and if structures to implement the given algorithm.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!