0% found this document useful (0 votes)
83 views5 pages

Labrpt2 Math505 New Format

This document provides instructions for a numerical methods laboratory experiment on Newton's divided difference method for polynomial interpolation. Students are asked to use Newton's method and MATLAB to interpolate a cubic polynomial and determine the value of y when x equals 7, given a data set with x-values of 4, 5, 9, 12 and y-values of 20, 24, 28, 37. The objectives are listed as learning Newton's divided difference method and using MATLAB for interpolation. Results and computations are to be shown for both Newton's method and the MATLAB polyfit and polyval functions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
83 views5 pages

Labrpt2 Math505 New Format

This document provides instructions for a numerical methods laboratory experiment on Newton's divided difference method for polynomial interpolation. Students are asked to use Newton's method and MATLAB to interpolate a cubic polynomial and determine the value of y when x equals 7, given a data set with x-values of 4, 5, 9, 12 and y-values of 20, 24, 28, 37. The objectives are listed as learning Newton's divided difference method and using MATLAB for interpolation. Results and computations are to be shown for both Newton's method and the MATLAB polyfit and polyval functions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 5

College of Engineering – Math & Science Department

2nd Trimester AY 2021-2022


MATH505 – NUMERICAL METHODS
Section : __MJ__

Every one should upload ;in the moodle

Laboratory Experiment No. _2_


___________________________________
Newton’s Divided Difference

Introduction - Newton’s divided difference method can be used to write the polynomial
function for use in interpolation without solving system of linear equations. A table can be
filled out so that the constants in the polynomial function is determined directly from the
table. There is also a method from Matlab that can be used to interpolate. This method
gives directly the polynomial function that can be used for interpolation, although this is
written differently from that of Newton’s divided difference.

Objectives (1) to be able to interpolate using Newton’s divided difference method


(2) to be able to use also the Matlab software to do the interpolation

Materials – Online Matlab software provided by AMA

Procedure - Solve the given problem below using Newton’s divided difference method
and Matlab.

From the data below, determine, by interpolation using a cubic polynomial, the value of y
if x = 7

Divided difference
x y 1st 2nd 3rd
4 20 = b0 b1 b2 b3
5 24
9 28
12 37

Laboratory Experiment No. ___ Page 1


Results – Write here your answers and computations

A. Newton’s divided difference method


Include the table here and the details of the computations for the entries in the table

B. MATLAB commands (direct method)

x=[4,5,9,12];
y=[20,24,28,37];
a=polyfit(x,y,3)

a =

0.1107 -2.5929 20.5821 -27.9286

polyval(a,7)

ans =

27.0714

Discussion –

Conclusion -

Laboratory Experiment No. ___ Page 2


Code

x1=[4 5 9 12];
y=[20 24 28 37];
syms x
pol=polyfit(x1,y,3) %returns the coefficients of the polynomial
polynomial=pol(1)*x^3+pol(2)*x^2+pol(3)*x+pol(4) %polynomial in x
y7=polyval(pol,7) % value of polynomial at x=7

Output

pol =

0.1107 -2.5929 20.5821 -27.9286

polynomial =

(31*x^3)/280 - (363*x^2)/140 + (5763*x)/280 - 7861193992419247/281474976710656

y7 =

Laboratory Experiment No. ___ Page 3


27.0714

References: use the references from the course specs in the moodle

Laboratory Experiment No. ___ Page 4


Laboratory Experiment No. ___ Page 5

You might also like