Answered step by step
Verified Expert Solution
Question
1 Approved Answer
******************************************MatLab Help please! ******************** Code that needs to be extended: Thank you! barycentric formula, TL 7 i-0 where we have defined the barycentric weights 7L
******************************************MatLab Help please! ********************
Code that needs to be extended: Thank you!
barycentric formula, TL 7 i-0 where we have defined the "barycentric weights" 7L j-0 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 "offlinc" and is efficiently updatable to include more interpolation points (b) Extend your code to allow x to be an array, so that y is an array of the same dimensions, cach entry bcing the Lagrange interpolation formula evaluated at the corresponding entry of x. Reusing from Part (a) the polynomial function p and the arrays X and Y, run the following commands x linspace (min (X)-1, max (X)+1, 100); plot (x , p(x), 'ko: ', x, nterp-bary(X, Y, x), 'rx:'); The red xs should coincide with the black os function y !interp(X,Y, X) sigma-0; for i#1 : numel (X) for j=1 : numel (X) if j-i end end sigma = sigma + Y(1)"pii; end y - sigma end barycentric formula, TL 7 i-0 where we have defined the "barycentric weights" 7L j-0 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 "offlinc" and is efficiently updatable to include more interpolation points (b) Extend your code to allow x to be an array, so that y is an array of the same dimensions, cach entry bcing the Lagrange interpolation formula evaluated at the corresponding entry of x. Reusing from Part (a) the polynomial function p and the arrays X and Y, run the following commands x linspace (min (X)-1, max (X)+1, 100); plot (x , p(x), 'ko: ', x, nterp-bary(X, Y, x), 'rx:'); The red xs should coincide with the black os function y !interp(X,Y, X) sigma-0; for i#1 : numel (X) for j=1 : numel (X) if j-i end end sigma = sigma + Y(1)"pii; end y - sigma endStep 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