3b If x xj 0 compute pnx via the barycentric interpolation

3b)

If x - xj ?  0;

compute pn(x) via the barycentric interpolation formula;

else;
set pn(x) = yj ;

Please explain the code so I can learn. Thank you!

Solution

This is matlab function which performs polynomial interpolation by the barycentric Interpolation formula. The formula states that:

p(x) = (SIGMA_(i=0 to n) w(i)*y(i)/(x - x(i)))/(SIGMA_(i=0 to n) w(i)/(x - x(i))).

CODE:

This algorithm states , x and y stand for the given points we are supposed to interpolate. w stands for the barycentric weights, which have been calculated before running the algorithm. And grid is the linspace over which the interpolation should take place:

3b) If x - xj ? 0; compute pn(x) via the barycentric interpolation formula; else; set pn(x) = yj ; Please explain the code so I can learn. Thank you!SolutionThi

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site