Question: WRITE MATLAB ... Write a function that, given a vector of values from an unknown function, estimates the derivative at a given point by interpolating

WRITE MATLAB ... Write a function that, given a vector of values from an unknown function, estimates the derivative at a given point by interpolating a quadratic polynomial through the closest 3 available points and differentiating the polynomial analytically. (Hint: sort could help you identify the closest points.) Submit your program

function df = diff_quad(x, y, x0)

% Given vectors of points x and y = f(x) % from an otherwise unknown function f, % estimate the derivative f' at x0 % by finding the 3 closest given points to x0 % and finding the derivative of the quadratic polynomial % that goes through those 3 x, f(x) values. % % Example: % x = 1:5, y = [2 1 8 3 2], x0 = 2.4 % closest 3 points are x = 1, 2, 3 % fitted polynomial is 4x^2 - 13x + 11 % derivative is 8x - 13 % the estimated derivative at x0 is 8*2.4 - 13 = 6.2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!