Question: All problems in this assignment are to be done using MATLAB. You will submit two script ( * . m ) files and two function

All problems in this assignment are to be done using MATLAB.
You will submit two script (*.m) files and two function (*.m) files, named appropriately and
each containing appropriate comments, containing the solutions to all problems.
a. Script files should be named in the following format: HWxPx.m
b. Function files must be named the same as the function.
Only files with *.m extensions will be accepted.
It is your responsibility to make sure that your script (*.m) file works properly and is free from
errors by utilizing the resources at your disposal.
a. DO NOT use the clear command in your code.
b. All final answers, and ONLY final answers, should be output to the command window, i.e.
make sure you use the ; to suppress output of each line that does not need to be
displayed to the command window.HW2P4(13 points)
Ocean water can be approximated as an incompressible fluid for which the equation of state relates the
density to the salinity and the temperature. The equation of state can be written
(S,T)=0[1+(T0-T)+(S-S0)]
where ,T and S are the density, temperature and salinity, respectively. The parameters and are
the thermal expansion coefficient and the haline contraction coefficient, respectively. The
thermodynamic state at Standard Temperature and Pressure (STP) and salinity from Gill 1982[1] is
given by (0,T0,S0). The values of parameters are given below
Furthermore, the pressure at a given depth is given by
p=pa+gh
where pa=101325Pa is the atmospheric pressure, g=9.81ms-2 is the acceleration due to gravity
and h is the depth below the surface in meters. The formulae for density and pressure are given in kg
m-3 and Pa respectively. Convert the density to grams per cc(1(g)cc-1=1000(kg)m-3) and the pressure
to bar (105(Pa)=1bar). You are required to calculate the density and pressure for given salinity,
temperature and depth.
Write a function file [,p]=EoS(S,T,h) which takes S,T and h as input arguments and returns
and p as output arguments. The function should assign local values to all constants. Use/call the
function to return and determine the values of and p in the command window for all inputs of the
table above.
Use the first several lines of your script/functions to describe the problem you are solving in the
comments.
 All problems in this assignment are to be done using MATLAB.

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!