Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Repeat Worksheet 6 Q1 for the barycentric formula, T1 TL wi yi where we have defined the barycentric weights While mathematically equivalent to the
1. Repeat Worksheet 6 Q1 for the barycentric formula, T1 TL wi yi where we have defined the "barycentric weights" While mathematically equivalent to the Lagrange interpolation formula, the barycentric formula has the prac- tical advantage that the bulk of the computation _computing the barycentric weights can be performed "offline" and is efficiently updatable to include more interpolation points. (a) Implement this as a Matlab function with the signature function y-linterp_bary(X, Y, x) (X and Y are arrays containing ro, , Tn 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. com paring p(x) with Interp-bary(X, Y, x). For example, implement x- 2,5-1 by p- 0(x) polyval([1 0 0 0 0-1], x); (b) Extend your code to allow x to be an array, so that y is an array of the same dimensions, each entry being the Lagrange intcrpolation formula cvaluated at thc corrcsponding cntry of x. Rcusing from Part (a) thc polynomial function p and the arrays X and Y, run the following commands xlinspace (min(X)-1, max (X)+1, 100); plot(x, p(x), 'ko: ', x, linterp_bary(X, Y, x), 'rx: '); The red s should coincide with the black os
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