Question
2. The density of water can be calculated using the following formulae: p = c1T3 + c2T2 + c3T + c4 where p = density,
2. The density of water can be calculated using the following formulae: p = c1T3 + c2T2 + c3T + c4
where p = density, T = temperature, and the cs are coefficients. The values of c depend on units of temperature and density. Ultimately, you will want to create a function that allows for different units for temperature, in addition to not requiring a temperature input and outputting the density at standard temperature (20C). If temperature units are not specified, the function should assume the units are in Celsius. The function can be called from the command line as the following:
d = dens d = dens(T) d = dens(T, units)
The equation for water density is only valid between 0 - 100 C. The coefficients for c are the following when the units are in Celsius, and the resulting density is in [kg/m3].
c1 = 1.54E-5 c2 = -5.87E-3 c3 = 1.79E-2 c4 = 1.00E+3
1. Write analgorithm for the function described above. (ALL IN MATLAB PLEASE)
2. Create a function as described above.You will need to include :nargin , errorcheck
for correct temperature input, and likely some if/elseif statements.
3. Run the function within ascript m-file to create a plot of density as a function of
temperature between 50 and 200F.
THANK YOU
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started