Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. The Lagrange interpolation formula, evaluates y p(), where z is given and p is the (unique) degree-n polynomial that interpolates n+1 given coor- dinate
1. The Lagrange interpolation formula, evaluates y p(), where z is given and p is the (unique) degree-n polynomial that interpolates n+1 given coor- dinate pairs. (zo, yo), (z, y), , (zn,Yn). ("Interpolates" means intersects. i.., yi-p(zi) for i-0,1, ,n.) (a) Implement this as a Matlab function with the signature function y - linterp(X, Y, x) (X and Y are arrays containing zo, .In and yo, , yn, resp.) You may not use any of Matlab's polynomial routines (like polyfit or interp1) nor the Symbolic Math Toolbox Test your code by 1. picking your favorite polynomial p of degree five, 2. populating X with six distinct numbers, 3. setting Y to be p evaluated at the corresponding entries of X, using polyval 4. picking x to be a number besides those in x. 5. comparing p(x) with linterp(X, Y, x) For example, implement2,5-1 by p-0(x) polyval([ 1 0 0 0 0-1], x)
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