The density of freshwater can be computed as a function of temperature with the
ID: 3757452 • Letter: T
Question
The density of freshwater can be computed as a function of temperature with the following cubic equation: =5.5289 ×10^(-8) T_C^3-8.5016×10^(-6) T_C^2+6.5622×10^(-5) T_C+0.99987 where = density (g/cm3) and TC = temperature (ºC). Use MATLAB to generate a vector of temperatures ranging from 32 ºF to 93.2 ºF using increments of 3.6 ºF. Convert this vector to degrees Celsius and then compute a vector of densities based on the cubic formula. Create a plot of versus TC. Recall that TC = 5/9(TF - 32). As a part of the .m script, also create a function called maxfunc.m that takes two vectors (temperature and corresponding densities) and prints to the screen (1) the maximum water density in the temperature range and (2) the temperature at which that temperature occurs. It should appear as follows: Maximum Density [g/cm3]: ## Occurs at Temperature (ºC): ## (Make sure the ## is replaced with the actual maximum value and actual temperature, and include a screenshot of the output in the results section.)
Explanation / Answer
This is a function to calculate the density based on two things temperature and salinity.
function dens=d(temp,sal)
sal=sal/10^6;
i=1002.4+754.8*sal+236.3*sal^2;
j=(-0.1338-0.935*sal-0.0976*sal^2);
k=(-0.003375+0.00996*sal-0.439*sal^2);
l=(0.00000313-0.0000163*sal+0.000244*sal^2);
dens=i+j*temp+k*temp^2+l*temp^3;
i think this might work
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.