You are on page 1of 1

Use a clamped cubic spline fit with zero end derivatives to

determine the thermocline depth. If k = 0.01 cal/ (s · cm · °C)


compute the flux across this interface.
4 5
18.3 The following is the built-in humps function that
2 1 AML 702 some of its numerical
MATLAB uses to demonstrate
capabilities: Lab 7

tural end condi- 1 1
1. Develop an M-file to compute a cubic spline fit with natural end conditions.
f (x) = + −6
conditions, and (x − 0.3)2 + 0.01 (x − 0.9)2 + 0.04
1 1
𝑓 𝑥 =
The humps function + − 6
n the following (𝑥 − 0.3)exhibits
, + 0.01 both
(𝑥 −flat and
0.9) , +steep
0.04 regions over
a relatively short x range. Here are some values that have
The humps function given above exhibits both flat and steep regions over a
been generated at intervals of 0.1 over the range from x = 0
relatively short x range. Here are some values that have been generated at
to 1:
intervals of 0.1 over the range from x = 0 to 1:
2 2.5 3
13 10 10 x 0 0.1 0.2 0.3 0.4 0.5
f (x) 5.176 15.471 45.887 96.500 47.448 19.000
0.6 0.7 0.8 0.9 1
be idealized as x
ture gradient or f (x) 11.692 12.382 17.846 21.703 16.000

can be defined
epth curve—that Test your code for the above function. Fit these data with (a) cubic spline with
Fit these data with a (a) cubic spline with not-a-knot end
depth, the heat natural end conditions, (b) with not-a-knot end conditions, (c) piecewise cubic
conditions and (b) piecewise cubic Hermite interpolation. In
an be computed Hermite interpolation. Plot all of these together in a single figure along with
both cases, create a plot comparing the fit with the exact
the exact humps function.
humps function.
18.4 Develop a plot of a cubic spline fit of the following
data with (a) natural end conditions and (b) not-a-knot end

You might also like