Description
Output of Code :
Lagrange Method of Interpolation
***************************Input Data******************************
x array of data:
xdata =
1 0 -2
y array of data:
ydata =
1 1 3
LINEAR INTERPOLATION:
x data chosen: x1 = 1, x2 = 0 , x3 = -2
y data chosen: y1 = 1, y2 = 1 , y3 = 3
The value of x at which y is desired, xdesired = 0.5
Final function =
fl =
(x*(x – 1))/2 – ((x – 1)*(x + 2))/2 + (x*(x + 2))/3
Lagrange weight function values, L0 = 0.416667, L1 = 0.625 , L2 = -0.0416667
The value of f(x) at xdesired, f(0.5) = 0.916667
Reviews
There are no reviews yet.