J1(x)
1.8
0.5815
-2
-637
2.0
0.5767
generate the third-order Newton's interpolating polynomial. Use the newtintr function to
interpolate at x = 2.1. Validate your answer using Matlab's polyfit and polyval functions.
-1
-96.5
2.2
0.5560
2. Ohm's law states that the voltage, resistance and current in a resistor are related by the
linear equation V=RI. In practice, however, real resistors may not always obey this law.
Suppose that you performed a precise experiment in the lab and obtained the following
data for the resistor.
-0.5
-20.5
2.4
0.5202
0.5
20.5
1
96.5
2
637
Use a fifth-order polynomial to fit the data and compute V for 1 = 0.1. Employ function
newtintr. Next, use Matlab's polyfit to generate the interpolation polynomial. Plot the data
points and the polynomial, on the same graph, for x-axis limits [-2.2 2.2].
1
3. Consider the function f(x) =
1+25x2
Generate five equidistantly spaced points
(xi, f (xi)) over the interval: [-1 1]. Fit this data with (a) a fourth-order polynomial, (b) a
linear spline and (c) a cubic spline. Assume spline derivatives are zero at the end points.
Compare your results graphically (use the x-axis range [-1 1]).
Fig: 1