06.09.2021 Views

First Semester in Numerical Analysis with Julia, 2020a

First Semester in Numerical Analysis with Julia, 2020a

First Semester in Numerical Analysis with Julia, 2020a

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 3. INTERPOLATION 121<br />

In l<strong>in</strong>ear spl<strong>in</strong>e <strong>in</strong>terpolation, we simply jo<strong>in</strong> data po<strong>in</strong>ts (the nodes), by l<strong>in</strong>e segments,<br />

that is, l<strong>in</strong>ear polynomials. For example, consider the follow<strong>in</strong>g figure that plots three data<br />

po<strong>in</strong>ts (x i−1 ,y i−1 ), (x i ,y i ), (x i+1 ,y i+1 ). We fit a l<strong>in</strong>ear polynomial P (x) to the first pair of<br />

data po<strong>in</strong>ts (x i−1 ,y i−1 ), (x i ,y i ), and another l<strong>in</strong>ear polynomial Q(x) to the second pair of<br />

data po<strong>in</strong>ts (x i ,y i ), (x i+1 ,y i+1 ).<br />

yi<br />

yi+1<br />

P(x)<br />

Q(x)<br />

yi-1<br />

xi-1 xi xi+1<br />

Figure 3.4: L<strong>in</strong>ear spl<strong>in</strong>e<br />

Let P (x) =ax + b and Q(x) =cx + d. We f<strong>in</strong>d the coefficients a, b, c, d by solv<strong>in</strong>g<br />

P (x i−1 )=y i−1<br />

P (x i )=y i<br />

Q(x i )=y i<br />

Q(x i+1 )=y i+1<br />

which is a system of four equations and four unknowns. We then repeat this procedure for<br />

all data po<strong>in</strong>ts, (x 0 ,y 0 ), (x 1 ,y 1 ), ..., (x n ,y n ), to determ<strong>in</strong>e all of the l<strong>in</strong>ear polynomials.<br />

One disadvantage of l<strong>in</strong>ear spl<strong>in</strong>e <strong>in</strong>terpolation is the lack of smoothness. The first<br />

derivative of the spl<strong>in</strong>e is not cont<strong>in</strong>uous at the nodes (unless the data fall on a l<strong>in</strong>e). We<br />

can obta<strong>in</strong> better smoothness by <strong>in</strong>creas<strong>in</strong>g the degree of the piecewise polynomials. In<br />

quadratic spl<strong>in</strong>e <strong>in</strong>terpolation, we connect the nodes via second degree polynomials.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!