Answered step by step
Verified Expert Solution
Question
1 Approved Answer
subject: MATLAB Lagrange Polynomial Interpolation The nh degree Lagrange polynoma rpolatig t (Tn+, Vnt-) is points ( ). (r2,2), n+1 We want to write a
subject: MATLAB
Lagrange Polynomial Interpolation The nh degree Lagrange polynoma rpolatig t (Tn+, Vnt-) is points ( ). (r2,2), n+1 We want to write a function file lagrangepoly.m with te following structure: function P lagra ng epoly(x, y, z) Here, and y wil be arrays contaning the interpolation data. The output P will be the Lagrange polynonnal evaluated at s. If s is an array, the function should r When complete, the code should work with code in the following way: turn an array. %x, y data pol nts x=[0 3 4.569); y= [ 0 .5 .7071 .8660 1); Sarray of 100 points evenly spaced from irst to last x value z = linspace (X (1), x (end), 100); sevaluate e Lagiange poly at each point in z pz = lagrangepoly(x, y, z); plot the Lagrange poly plot (z, pz) hold on plot the data plot (x, y,'''MarkerSize', 5)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started