The density of freshwater can be computed as a function of temperature with the
ID: 3784232 • Letter: T
Question
The density of freshwater can be computed as a function of temperature with the following equation: rho = 5.5289e-8 T^3 - 8.5016e-6 T^2 + 6.5622e-5 T + 0.99987 where rho = density (g/cm^3) and T = temperature (degree Celsius) Use MATLAB to generate a vector of temperatures form 0 to 34 degrees Celsius in steps of 2 degrees. Then compute a vector of densities for these temperatures. Plot the densities versus the temperature in Fahrenheit, noting that Tf = 9*T/5 + 32, where Tf is the temperature in Fahrenheit. The MATLAB function is to not have any "for" or "while" loops in it. All calculations are to be done using vector operations. For example if you have a vector of x values and you want to evaluate it as a a quadratic ax^2 + bx + c then you can write hi MATLAB y = a * x middot * x + b * x + c; and this will create a vector y that is the evaluation of the quadratic for each element hi x. Points to note, 1) a, b and c must be scalars (single values, not vectors), and 2) the .* between the first two instances of x, indicates a point by point operation.Explanation / Answer
x=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34];
pp=5.5289000000000*power(x,3)-8.501600000*power(x,2)+6.562200000*x+0.9998; % equation to calculate value of density
tf=9*x/5+32; % Equation for calculating value of temparature in fahrenheit
plot (x,tf) % ploting density versus fahrenheit
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.