Question: Practice with the command interp1. Write a function in MATLAB called SW to calculate the Specific Weight of Water (in pcf) based on a single
Practice with the command interp1.
Write a function in MATLAB called SW to calculate the Specific Weight of Water (in pcf) based on a single input, the water temperature (in F). The water temperature will be a single variable in the range of 40 deg F to 100 deg F. Predict the value using the command interp1 to perform linear interpolation of the data in the table below.
HINTS:
The input is a single number, the temperature.
You should have a single output equal to the calculated Specific Weight.
The function name must be SW.
| Water Temperature (deg F) | Specific Weight (in pcf) |
| 40 | 62.43 |
| 50 | 62.41 |
| 60 | 62.37 |
| 70 | 62.30 |
| 80 | 62.22 |
| 90 | 62.11 |
| 100 | 62.0 |
You need to copy and paste the data above into your function
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
