I have to write a Matlab function called "interpoly(x,y) which calculates the corresponding interpolation polynomial for given support points (xj,fj) with x=[x1,x2,...,xn] and f=[f1,f2,...,fn] and in interval x[min xj, max xj] plotted.
Any method can be used to calculate the interpolation polynomial but I think Lagrange would be the best.
One rule is that I can not use "polyfit" command.
I have to test the programm with values of fj of the functions f(x)=cos(x) and f(x)=1/(1+x^2) each in the interval [-6,6]. I have to use both equidistant support points and Tschebscheff support points.
It is okay to use linspace(a,b,n) to generate n equidistant support points in the interval [a,b].
I add the question as a picture.
10 have requested this problem solution
The more requests, the faster the answer.
Consider polynomial interpolation of the function f(x)=1/(1+25x^2) on the interval [-1,1] by (1) an interpolating polynomial determined by m equidistant interpolation points, (2) an interpolating polynomial determined by interpolation at the m zeros of the Chebyshev polynomial T_m(x), and (3) by interpolating by cubic splines instead of by a polynomial. Estimate the approximation error by evaluation max_i |f(z_i)-p(z_i)| for many points z_i on [-1,1]. For instance, you could use 10m points z_i. The cubic spline interpolant can be determined in...
For an nth-order Newton's divided difference interpolating polynomial fn(x), the error of interpolation can be estimated by Rn-| g(xmPX, , xm» ,&J . (x-x-Xx-x.) . . . (x-x.) | , where (xo, f(xo)), (xi, fx)).., (Xn-1, f(xn-1) are data points; g[x-,x,,x-.., x,] is the (n+1)-th finite divided difference. To minimize Rn, if there are more than n+1 data points available for calculating fn(x) using the nth-order Newton's interpolating polynomial, n+1 data points (Xo, f(xo)), (x1, f(x)), , (in, f(%)) should...
Consider the function f(x) 1 25x which is used to test various interpolation methods. For the remainder of this problem consider only the interval [-1, 1] The x-values for the knots (or base-points) of the interpolation algorithm are located at x--1,-0.75, -0.5, -0.25, 0, 0.25, 0.5, 0.75 1. (a) Create a "single" figure in Matlab that contains 6 subplots (2x3) and is labelled as figure (777), i.e the figure number is 777. Plot in each subplot the function f(x) using...
**********************matlab code please******************* 1. Interpolation error of polynomial fit Using 11 equi-distributed points (10 equal segments) in the interval [-1 1], Using Newton's form find and plot the interpolating polynomial p(x) for the function f(x) -1/(125x2). Comment on the large discrepancies between p(x) and the function f(x) that the data came from Write down an expression for the error in the interpolating polynomial above? Which part of the expression is responsible for the large errors observed? 1. Interpolation error of...
IN MATLAB Write a MATLAB function that can be used by a user to perform polynomial interpolation using Lagrange Interpolation Method on a set of data. You should name your function as YourInitials_Lagrange_interpolation. 1. FUNCTION INPUT: . The input data pairs x and f(x) should be expressed as vectors and are used to construct the interpolation polynomials The interpolating data points/value The order of interpolating polynomials to be used. For this project you code should handle first order, second order...
Please help me solve this. #4 a&b. thanks We were unable to transcribe this imageeilymai retine, or you m yur ova rodinT ur pl nda listing of your code. (b) Repeat part (a) with a polynomial of degree 12 that interpolates f at 13 scaled Chebyshev points, x 5 cos 12 Again you may use MATLAB's polyfit and polyval routines to fit the polyno- mial to the function at these points and evaluate the result at points throughout the interval,...
matlab matlab For this problem you will test a few interpolation approaches for the application of generating interpolated data. We'll do this by interpolating data that is sampled from a known mathematical function. The same function can then be used to compute true values at the interpolated points to use in error Consider the following mathematical function (Runge's function): 1+25r2 Write a function mfile that uses this formula to generate a set of data use those points along approaches outlined...
1. Consider the polynonial Pl (z) of degree 4 interpolating the function f(x) sin(x) on the interval n/4,4 at the equidistant points r--r/4, xi =-r/8, x2 = 0, 3 π/8, and x4 = π/4. Estimate the maximum of the interpolation absolute error for x E [-r/4, π/4 , ie, give an upper bound for this absolute error maxsin(x) P(x) s? Remark: you are not asked to give the interpolation polynomial P(r). 1. Consider the polynonial Pl (z) of degree 4...
Please MATLAB for all coding with good commenting. (20) Consider the function f(x) = e* - 3x. Using only and exactly the four points on the graph off with x-coordinates -1,0, 1 and 2, use MATLAB's polyfit function to determine a 3' degree polynomial that approximates f on the interval (-1, 2]. Plot the function f(x) and the 360 degree polynomial you have determined on the same set of axes. f must be blue and have a dashed line style,...
Problem 2 Let f(x) = sin 2x and P() be the interpolation polynomial off with degree n at 20,***, Im Show that \,f(z) – P() Sin+1 – 20) (1 - 11). (I – In).