Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Repeat Worksheet 6 Q1 for the barycentric formula, i-0 i-0 where we have defined the barycentric weights j-0 While mathematically equivalent to the Lagrange

image text in transcribed

1. Repeat Worksheet 6 Q1 for the barycentric formula, i-0 i-0 where we have defined the "barycentric weights" 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 "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,... , Jn, 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_bary (X, Y, x) For example, implement rHr5-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 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 xlinspace (min(X)-1, max (X)+1, 100); plot(x, p(x), 'ko:', x, linterp_bary(X, Y, x), 'rx: '); The red xs should coincide with the black os

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications Dexa 2021 Workshops Biokdd Iwcfs Mlkgraphs Al Cares Protime Alsys 2021 Virtual Event September 27 30 2021 Proceedings

Authors: Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil ,Bernhard Moser ,Atif Mashkoor ,Johannes Sametinger ,Anna Fensel ,Jorge Martinez-Gil ,Lukas Fischer

1st Edition

ISBN: 3030871002, 978-3030871000

More Books

Students also viewed these Databases questions

Question

d. How were you expected to contribute to family life?

Answered: 1 week ago