Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Lagrange Polynomial Interpolation O solutions submitted (max: 10) We want to write a function file lagrangepoly.m with the following structure: function P = lagrangepoly(x,y,z) Here,
Lagrange Polynomial Interpolation O solutions submitted (max: 10) We want to write a function file lagrangepoly.m with the following structure: function P = lagrangepoly(x,y,z) Here, x and y will be arrays containing the interpolation data. The output P will be the Lagrange polynomial evaluated at z. If z is an array, the function should return an array. Function Reset MATLAB Documentation i function P = lagrangepoly(x,y,z) 2 % x, y = data (stored as vectors) 3 Sz = evaluation points) 4 % P = the lagrange polynomial evaluated at all points in z end function x = poly(varargin) 11 * = fprintf('This program uses the function poly, which is not allowed to be used for this homework assignment. '); 12 end 13 function x = polyval(varargin) 14 x = fprintf('This program uses the function polyal, which is not allowed to be used for this homework assignment. '); 15 end Code to call your function C Reset 1 SAs a quick check: 2 $x = (1 2 3 4 5] 3 Sy = log(x) 4 the Lagrange poly evaluated at z = 2.2 is 0.7901 Lagrange Polynomial Interpolation O solutions submitted (max: 10) We want to write a function file lagrangepoly.m with the following structure: function P = lagrangepoly(x,y,z) Here, x and y will be arrays containing the interpolation data. The output P will be the Lagrange polynomial evaluated at z. If z is an array, the function should return an array. Function Reset MATLAB Documentation i function P = lagrangepoly(x,y,z) 2 % x, y = data (stored as vectors) 3 Sz = evaluation points) 4 % P = the lagrange polynomial evaluated at all points in z end function x = poly(varargin) 11 * = fprintf('This program uses the function poly, which is not allowed to be used for this homework assignment. '); 12 end 13 function x = polyval(varargin) 14 x = fprintf('This program uses the function polyal, which is not allowed to be used for this homework assignment. '); 15 end Code to call your function C Reset 1 SAs a quick check: 2 $x = (1 2 3 4 5] 3 Sy = log(x) 4 the Lagrange poly evaluated at z = 2.2 is 0.7901
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