Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a Matlab function, called Newtons_divided_differences Newton's divided differences O solutions submitted (max: 5) Write a MATLAB function, called Newtons_divided_differences that inputs a set of
Write a Matlab function, called Newtons_divided_differences
Newton's divided differences O solutions submitted (max: 5) Write a MATLAB function, called Newtons_divided_differences that inputs a set of data points datx, daty, a column vector x of numbers at which to interpolate, and outputs the divided differneces table, F, and the polynomial interpolant, y, a column vector, evaluated at x using Newton's divided differences. Your function header should look something like: function [y,F] = Newtons_divided_differences (x,datx, daty) See the template to help you get started You can test your code doing the example provided in class: datx= [5,6,9,11]; daty=[12,13,14,16]; X=[5: 1:11]'; %DO NOT FORGET THE APOSTROPHE. IT IS WHAT MAKES THIS A COLUMN VECTOR [y,F]=Newtons_divided_differences (x, datx,daty) You can then plot datx, daty, on the same graph as x,y. Does the interpolating function (x,y) go through the data points? You can also check F to see if it matches the table we found in class. Write a MATLAB function, called Newtons_divided_differences that inputs a set of data points datx,daty, a column vector x of numbers at which to interpolate, and outputs the divided differeces table, F, and the polynomial interpolant, y, a column vector, evaluated at x using Newton's divided differences. Your function header should look something like function [y,F] = Newtons_divided_differences(x,datx, daty) See the template to help you get started You can test your code doing the example provided in class datx=(5,6,9,11]; daty=[12,13,14,16]; X=[5: 1:11]'; %DO NOT FORGET THE APOSTROPHE. IT IS WHAT MAKES THIS A COLUMN VECTOR [y,F]=Newtons_divided_differences(x,datx,daty) You can then plot datx, daty, on the same graph as x,y. Does the interpolating function (x,y) go through the data points? You can also check F to see if it matches the table we found in class. Function Reset ES MATLAB Documental 1 function (),F] = Newtons_divided_differences (x,datx,daty) %function that computes the Lagrange interpolant of f over [a,b] % using Newton's divided differences INPUTS: % (datx, daty) is set of points from which we create the interpolant % x is the set of point to interpolate on % OUTPUT: % y the interpolating polynomial % F the divided difference table N = length(datx); F = NaN*ones(N,N); F(:,1) = daty; % first column is the solutions y. creation of divided differences table % creation of polynomial 19 % evaluate polynomial 2e 21 end Code to call your function CR 1 datx=[5,6,9,11]; 2 daty=[12,13,14,16]; 3 X=[5:.1:11]'; %DO NOT FORGET THE APOSTROPHE. IT IS WHAT MAKES THIS A COLUMN VECTOR [y,F]=Newtons_divided_differences(x, datx, daty)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