Answered step by step
Verified Expert Solution
Link Copied!

Question

00
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

image text in transcribed

Here is part a)

image text in transcribed

(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

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions