In numerical computation, we approximate the integrand by an interpolant that we are able to integrate
exactly. This is known as quadrature. Quadrature is the integration of a function of one variable. When
we integrate a function of two variables, it is called cubature. This is precisely what we will be doing to
ﬁnd the volume of a speciﬁc section of the ocean. Using a continuation of the trapezoid formula and build-
ing onto it, we will use our coordinates to create little rectangles R in our ocean patch. By taking the
double integral of these rectangles we are able to discretize each variable, which will result in a decompo-
sition of R in a rectangle with nodes at each corner. Doing this decomposition over the whole area of the
ocean patch and taking the sums of each individual volume will get us the volume of the whole ocean section.
2 Mathematical Content
In the following sections, we will show the required mathematical content that will ultimately allow us to
approximate the volume of water held in a section of the ocean.
2.1 Part 1.
The ﬁrst part of the Mathematical Content asked us to derive the exact expressions for the interpolant Lij
over the rectangle whose lower left corner is (xi, yj), in terms of h, k, and four values Zij, Zi+1,j, Zi,j+1,
Zi+1,j+1. The steps we took to derive the interpolant are shown below.
There are four constants that need to be determined by the data at the four corners. We deﬁne the four
corner constants as a, b, c, and d. Then the accurate interpolation formula can be derived. The expression
is given as follows:
Lij(x, y) = a + bx + cy + dxy (2.1)
We let the four corner coordinates be represented as (xi, yj) where i = 1, 2 and j = 1, 2. Then, we plug these
into equation 2.1 and we end up with the set of four equations below.
L11 = a + bx1 + cy1 + dx1y1
L12 = a + bx1 + cy2 + dx1y2
L21 = a + bx2 + cy1 + dx2y1
L22 = a + bx2 + cy2 + dx2y2
In equation set 2.2, a, b, c, and d are unknown and everything else is known. Therefore, by solving the
above set of equations for a, b, c, and d we obtain results which can be found in the corresponding MATLAB
MuPad Notebook titled “Project3”. (This ﬁle will be attached to the submission along with our ocean
2.2 Part 2.
The second part of the Mathematical Content asked us to integrate the interpolant over the rectangle to get
another expression in terms of the same quantities.
The formula to ﬁnd the volume of an object described by the function f is deﬁned as:
f(x, y) dx dy (2.3)
Where R ∈ [x0, xm] × [y0, yn]. Therefore, we can deﬁne that for each small rectangular area r, we have that
r ∈ [xi, xi+1] × [yj, yj+1].
Then, we ﬁnd the volume Vij to be:
Lij(x, y) dx dy (2.4)
(a + bx + cy + dxy) dx dy (2.5)
(a + bx + cy + dxy) dx dy (2.6)
(xi+1 − xi) (yi+1 − yi) (4a + 2bxi + 2bxi+1 + 2cyj + 2cyj+1 + dxiyj + dxi+1yj + dxiyj+1 + dxi+1yj+1)
2.3 Part 3.
The third part of the Mathematical Content asked us to show that if the Vij are added up over all i and j,
the result is identical to applying the trapezoid formula in each direction sequentially over the domain (i.e.,
as an iterated integral).
First, we discretize each variable using the space steps h and k, respectively, so that xi = x0 + ih for
i = 0, ..., m, and yi = y0 + jk for j = 0, ..., n. This requires that h = (xm − x0)/m and k = (yn − y0)/n.
After applying this discretization over the entire region R ∈ [x0, xm]×[y0, yn], the formula for the cumulative
f(x, y) dx dy (2.8)
V = Vij dv (2.9)
(xi+1 − xi) (yi+1 − yi) (4a + 2bxi + 2bxi+1 + 2cyj + 2cyj+1 + dxiyj + dxi+1yj
+ dxiyj+1 + dxi+1yj+1) dx dy
When we apply the trapezoid formula we obtain:
f(x, y) dx dy (2.11)
V = Vij dv (2.12)
f(x0) + f(x1) + f(x2) + L
+ f(xm−1 +
f(y0) + f(y1) + f(y2) + L + f(yn−1) +
f(yn) dx dy
In principle, the two formulas above, 2.10 and 2.13, are identical.
3 Computational Content
In the following section we will explain the details that are needed to acquire the same raw data from the
GeoMapApp and compute our volume result.
3.1 Obtaining the Data
In order to obtain the raw data from the app, we had to ﬁrst download the GeoMapApp and choose a map
location. Once the location was chosen, we were able to zoom in several times to a part of the ocean. We
made sure that our image only included about 1-2 degrees of latitude.
More speciﬁcally, when choosing the world view, we chose the ”Mercator” view. This view gives us a better
distinction between the diﬀerent oceans. We decided to take data from a section of the Atlantic Ocean
oﬀ the coast of Florida. The longitude and latitude coordinates of our section of data were, respectively,
about 073.6°W to 071.6°W and 030.4°N to 031.5°N. Clicking the load grid and grid-lines button provides a
histogram of elevation in the section of ocean, which gives us the z value for every x and y longitude and
latitude coordinates. We then extracted the data and imported it into MATLAB, which gave us 494, 802
3.2 Converting the Data to Kilometers
In order to convert the raw data into units of kilometers we chose to use a built in MATLAB function called
“deg2km”. We decided to use our own version of Earth’s radius, in kilometers, so that it is the most updated
numerical value. Below is the code we used to convert the x and y vectors of values to kilometers.
R = 6378.1; % radius of earth in kilometers
kmX = deg2km(X( : ) ,R) ;
kmY = deg2km(Y( : ) ,R) ;
After we have converted x and y to kilometers, we need to convert z, the depth, into kilometers as well.
When we downloaded the raw data from the GeoMapApp we are given the z data in meters. Therefore, to
convert to kilometers, all we need to do is divide all of the values of z by 1000.
Z = Z./1000;
3.3 Computing the Volume
Our function, ocean(x, y, z), takes the three vectors of data that are exported from the GeoMapApp using
the process we explained in an earlier section (“Obtaining the Data”). We can import the extracted data
data = importdata ( ’ Project3Data2 . xyz ’ ) ;
% extract x , y , z
x = data ( : , 1 ) ;
y = data ( : , 2 ) ;
z = data ( : , 3 ) ;
The above process allows us to test our function in a script ﬁle.
Now, we will explain what our function does. Inside of our function, the ﬁrst things computed are the
dimensions needed in order to convert x, y, and z into matrices.
num = length (x ) ;
i f i s e q u a l (x (1) , x (2))
f or i = 1:num
i f x( i )˜= x( i +1)
n = i ; % Y d i r e c t i o n node number
m = f i x (num/n ) ; % X d i r e c t i o n node number
e l s e i f i s e q u a l (y (1) , y (2))
f or i =1:num
i f y( i )˜= y( i +1)
m = i ; % X d i r e c t i o n node number
n = f i x (num/m) ; % Y d i r e c t i o n node number
e l s e
disp ( ’ Your data i s wrong ! ’ )
Once the dimensions are determined, we convert the vectors x, y, and z into kilometers using the method
described in the previous section, “Converting the Data to Kilometers”, and then we reshaped the vectors
Z = reshape ( z ( 1 :m∗n ) ,m, n ) ;
X = reshape (x ( 1 :m∗n ) ,m, n ) ;
Y = reshape (y ( 1 :m∗n ) ,m, n ) ;
The ﬁnal part of our function takes everything we have done so far and implements our mathematical content
to ﬁnd the volume:
volume = 0;
f or i = 1:m 1
f or j = 1: n 1
x range = X( i +1, j ) X( i , j ) ;
y range = Y( i , j +1) Y( i , j ) ;
z = mean ( [ Z( i , j ) ,Z( i +1, j ) ,Z( i +1, j +1) ,Z( i , j +1)]);
volume = abs ( volume)+x range ∗ y range ∗ z ;
After running our function ocean with the imported data from the GeoMapApp, we obtain a volume of
1.351236736093395 × 1005
. Below you can see a recreation of our ocean using the data after it has been
converted to kilometers and reshaped:
Figure 1: Sea Surface Simulation: volume = 1.35125 × 1005
4 Veriﬁcation of our Solution
To verify our volume function we decided to evaluate the volume of a rectangular prism that closely rep-
resented our data. For the x and y coordinates we took the diﬀerence between the largest value and the
smallest vale to represent the length and width of the prism. For the height, we took the absolute value of
the average of all the z values in our data. We have to take the absolute value since all the z values represent
depth, being measured down from sea level, and are therefore negative. Using basic geometry, we multiplied
the length, width, and height to obtain a volume of our simpliﬁed ocean. Below is the code that we used to
verify our volume.
% Given raw data x , y , z
% Step 1: convert to kilometers
R = 6378.1; % radius of earth in kilometers
kmX = deg2km(x ( : ) ,R) ;
kmY = deg2km(y ( : ) ,R) ;
kmZ = z ./1000;
% Step 2: find the distance f o r X and Y
x d i s t = max(kmX) min(kmX) ;
y d i s t = max(kmY) min(kmY) ;
% Step 3: find the average Z value
z height = abs (sum(kmZ)/ s i z e (Z , 1 ) ) ;
% Step 4: find the volume of a rectangle
volume = x d i s t ∗ y d i s t ∗ z height ;
Implementing this code on the data we found using the GeoMapApp, we obtain a volume of
1.351220950860681 × 105
. Our volume function returns 1.351236736093395 × 1005
when run with our data.
We can automatically check that our two volume results are of the same magnitude using:
o r d e r t e s t = f l o o r ( log10 (v ) ) ;
order ver = f l o o r ( log10 ( volume ) ) ;
i f ( o r d e r t e s t == order ver )
disp ( ’ The order of magnitude i s correct ! ’ )
e l s e
disp ( ’ The order of magnitude i s wrong ! ’ )
Therefore, when we run the above code using our value obtain from our volume function (test) and the value
obtained from the veriﬁcation method (ver) we return “The order of magnitude is correct!”
In this section we will be explaining what each team member speciﬁcally contributed to this project.
Our team members include:
1. Alyson Grassi: Alyson converted the data from degrees into kilometers and worked with Melanie to
determine our veriﬁcation method. She also, helped to debug the ocean function. She typed and reﬁned
all of the mathematical content from Yijun into LaTeX and organized the paper. Alyson helped to
edit the ﬁnal paper.
2. Ryan Hunte: Ryan assisted in trying to get the code to run properly. He asked questions to get the
team thinking and trying to solve problems in a diﬀerent perspective. He wrote the introduction to
the paper and also helped edit the ﬁnal paper.
3. Melanie Steiger: Melanie retrieved the data from the GeoMapApp and explained the process under
the ’Computational Content’ section. She also worked with Alyson in creating the veriﬁcation method
and helped debug the ocean function. Melanie helped to edit the ﬁnal paper.
4. Yijun Zhou: Yijun coded the rough draft of the ocean function and some debugging. Later, she tried
in diﬀerent ways and edited the function to work properly. She also worked on mathematical content
and wrote up a draft of mathematical content (Part 2). She edited MATLAB MuPad Notebook titled
”Project3”, which makes mathematical derivation more understandable.