Question: Here is part a) (c) Write Matlab code that uses your approximation to compute the derivative of any function f. The code should be a

Here is part a)

(c) Write Matlab code that uses your approximation to compute the derivative of any function f. The code should be a function called First Der(). FirstDer takes in two inputs: the first is the set of all points (X) at which we want the derivative, and the second is the set of data/function values at those points (Y - flx -f(tk),k - 0,.. . .N). So, you have First Der(X,Y). The output is the list of values of the first derivative at each of the points computed by your formula from part a. The function f should be defined as an anonymous function in a file called DriverDer, which calls FirstDer) with the appropriate inputs, collects the outputs, computes errors, and plots them. Assume the points in X are sorted in ascending order HINT: Loop over x, grab 3 points at a time, apply your formula from part a. Pay careful attention to the first and last points in your list. 24-4 Cx, h2 -%)(, (c) Write Matlab code that uses your approximation to compute the derivative of any function f. The code should be a function called First Der(). FirstDer takes in two inputs: the first is the set of all points (X) at which we want the derivative, and the second is the set of data/function values at those points (Y - flx -f(tk),k - 0,.. . .N). So, you have First Der(X,Y). The output is the list of values of the first derivative at each of the points computed by your formula from part a. The function f should be defined as an anonymous function in a file called DriverDer, which calls FirstDer) with the appropriate inputs, collects the outputs, computes errors, and plots them. Assume the points in X are sorted in ascending order HINT: Loop over x, grab 3 points at a time, apply your formula from part a. Pay careful attention to the first and last points in your list. 24-4 Cx, h2 -%)(
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
