Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

LAGRANGE INTERPOLATION POLYNOMIAL table [ [ Name: , Grade ( 5 ) ] , [ ID Number:, ] , [ Lab Section:, ] ]

LAGRANGE INTERPOLATION POLYNOMIAL
\table[[Name:,Grade (5)],[ID Number:,],[Lab Section:,]]
Objectives
Knowing how to perform an interpolation with a Lagrange polynomial.
To understand the MATLAB implementation of the Lagrange Interpolation method.
To study the effect of extrapolation.
Algorithm
Suppose we formulate a linear interpolating polynomial as the weighted average of the two values that we are connecting by a straight line:
f(x)=L1f(x1)+L2f(x2)
where the L's are the weighting coefficients. It is logical that the first weighting coefficient is the straight line that is equal to 1 at xI and 0 at x2 :
L1=x-x2x1-x2
Similarly, the second coefficient is the straight line that is equal to 1 at x2 and 0 at x1 :
L2=x-x1x2-x1
Substituting these coefficients into the first equation yields the straight line that connects the points:
f1(x)=x-x2x1-x2f(x1)+x-x1x2-x1f(x2)
where the nomenclature f1(x) designates that this is a first-order polynomial. This equation is referred to as the linear Lagrange interpolating polynomial.
The same strategy can be employed to fit a parabola through three points. For this case three parabolas would be used with each one passing through one of the points and equaling zero at the other two. Their sum would then represent the unique parabola that connects the three points. Such a second-order Lagrange interpolating polynomial can be written as:
1
f2(x)=(x-x2)(x-x3)(x1-x2)(x1-x3)f(x1)+(x-x1)(x-x3)(x2-x1)(x2-x3)f(x2)
+(x-x1)(x-x2)(x3-x1)(x3-x2)f(x3)
Notice how the first term is equal to f(xl) at xl and is equal to zero at x2 and x3. The other terms work in a similar fashion.
Both the first- and second-order versions as well as higher-order Lagrange polynomials can be represented concisely as
fn-1(x)=i=1nLi(x)f(xi)
where
]=[1
where n= the number of data points and I designates the "product of."
Practical Work
Preliminary Work (to be done before lab session)
Use a Lagrange interpolating polynomial to find the solution y at x=15, based on the following values of xa and ya:
xa=[-4002050]
ya=[1.521.291.21.09]
Lab Work
Given the following Algorithm of LAGRANGE Interpolation formula:
Step 1. Start the Program
Step 2. Input number of terms n
Step 3. Input the array ax
Step 4. Input the array ay
Step 5. for nr=1dr=1i=0;i
Step 6.nr=1
Step 7.dr=1
2
Step8. for jinr=nr**(x-ax[j])dr=dr**(ax[i]-ax[j])Y=(nrdr)**ix,yj=0;j
Step 9.Ifji
a.nr=nr**(x-ax[j])
b.dr=dr**(ax[i]-ax[j])
Step 10. End Loop j
Step 11.Y=(nrdr)**ayi
Step 12. End Loop i
Step 13. Print Output x,y
Step 14. End of Program
Write a well commented MATLAB Program for the given Algorithm
3
Use your program to find the value of y at x=15, based on the following values of xa and ya:
xa=[-4002050]
ya=[1.521.291.21.09]
Assume you have the following function f(x)=x.?**sin(2**x). Plot the function y=f(x) at x=-1:0.01:+1. Then use the Lagrange algorithm to find the values of y at the given values of x, if the given points to be used are:
xp=[0,4,2,3**4,];
yp=f(xp);
Plot the results on the same graph to detect the interpolation and extrapolation from the graph. (Hint: Use the command hold on to plot more than one function at the same graph)
4
LAGRANGE INTERPOLATION POLYNOMIAI
\table[[Name:,Grade (5)],[ID Number:,],[Lab Section:,]]
Objectives
Knowing how to perform an interpolation with a Lagrange polynomial,
To understand the MATLAB implementation of the Lagrange Interpolation method.
To study the effect of extrapolation.
Algorithm
Supp
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions

Question

Did the researcher provide sufficient description?

Answered: 1 week ago