0% found this document useful (0 votes)
41 views

3 Homework Set No. 3: Problem 1

This document contains 7 homework problems related to splines: 1. Determine if a given function is a first-degree spline. 2. Derive an error estimate for polynomial interpolation using a linear polynomial. 3. Determine if a given function can be represented as a natural cubic spline. 4. Determine if a given function is a cubic spline with specified knots. 5. Given data, find the linear and natural cubic spline interpolating the data. 6. Write a Matlab function to compute a linear spline for a given data set. 7. Use Matlab functions to draw Mount Everest using a natural cubic spline.

Uploaded by

kelbmuts
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

3 Homework Set No. 3: Problem 1

This document contains 7 homework problems related to splines: 1. Determine if a given function is a first-degree spline. 2. Derive an error estimate for polynomial interpolation using a linear polynomial. 3. Determine if a given function can be represented as a natural cubic spline. 4. Determine if a given function is a cubic spline with specified knots. 5. Given data, find the linear and natural cubic spline interpolating the data. 6. Write a Matlab function to compute a linear spline for a given data set. 7. Use Matlab functions to draw Mount Everest using a natural cubic spline.

Uploaded by

kelbmuts
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

3 Homework Set No.

3
Problem 1.

Determine whether this function is a first-degree spline:



 x −1 ≤ x ≤ 0.5
S(x) = 0.5 + 2(x − 0.5) 0.5 ≤ x ≤ 2
x + 1.5 2≤x≤4

Problem 2.

Show that f (x) − p(x) = 21 f ′′ (ξ)(x − a)(x − b) for some ξ in the interval (a, b), where p
is a linear polynomial that interpolates f at a and b.
Hint: Use an error estimate from polynomial interpolation.

Problem 3.

Do there exist a, b, c and d so that the function

ax3 + x2 + cx

−1 ≤ x ≤ 0
S(x) = .
bx3 + x2 + dx 0≤x≤1

is a natural cubic spline?

Problem 4.

Determine whether f is a cubic spline with knots -1, 0, 1 and 2:



 1 + 2(x + 1) + (x + 1)3 −1 ≤ x ≤ 0
f (x) = 3 + 5x + 3x2 0≤x≤1 .
11 + (x − 1) + 3(x − 1)2 + (x − 1)3 1≤x≤2

Problem 5: Spline exercise.

Given data set:

ti 1.2 1.5 1.6 2.0 2.2


yi 0.4275 1.139 0.8736 −0.9751 −0.1536

a). Let L(x) be the linear spline that interpolates the data. Describe what L(x)
consists of and what conditions it has to satisfy. Find L(x), and compute the
value for L(1.8).

1
b). Let C(x) be the natural cubic spline that interpolates the data. Describe what
C(x) consists of and what conditions it has to satisfy. Find C(x), and compute
the value for C(1.8).

Do not do this problem in Matlab. Part (b) can be time consuming, therefore you could
use Matlab to solve the linear system here.

Problem 6: linear spline in Matlab.

Write a matlab function that computes the first order spline for a given data set. You
might need to take a look at the file cspline_eval.m for problem 7 to start with. Call
your matlab function lspline, define it in the file lspline.m as:

function ls=lspline(t,y,x)
% lspline computes the linear spline
% Inputs:
% t: vector, contains the knots
% y: vector, contains the interpolating values at knots
% x: vector, contains points where the lspline shoule be
% computed
% Output:
% ls: vector, contains the values of lspline at points x

Use your matlab function on the data set given in problem 5, plot the linear spline for
the interval [1.2, 2.2].
What to hand in: Hand in the matlab file lspline.m, and the plot of your linear
spline.

Problem 7: natural cubic spline in Matlab

The goal of this home work is to draw the mountain Everest with the help of spline.
We have a photo, probably rather poor quality, of the mountain, which is given below.
We are aware that the mountain tops are not very clear in that photo, so please use
your fantasy. Select your knots, measure these points to generate your data set. Use the
functions cspline and cspline_eval , which are available from the course web site.
Read these two functions carefully, try to understand them before using them.

What you need to hand in: A Matlab script that reads in your data set, compute
the spline functions, and draw the mountain. Also the plot of your mountain Everest.

2
Figure 1: Natural cubic spline, for Mount Everest.

You might also like