Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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