Question: Create a MATLAB function: There are many other ways of approximating the derivative using finite differences. For points in x equidistant by h, a centered
Create a MATLAB function:
There are many other ways of approximating the derivative using finite differences. For points in x equidistant by h, a centered estimate for the first derivative of f(x) is f(x + h) - f(x - h) 21 One-sided estimates can be computed by I f'(x) = 3f(z) 4f (x - h) + f(x 21) 2h -3f(x) + 4f (x + h) - f(x + 2h) f'(z) = - 2h (9) Note that 2 points are need to compute a centered estimate and 3 points are need for one-sided estimates. 1. Write a function yp = MyDer (h,y) that takes in the x-spacing h, an array of data y and returns the first-order derivative yp of y using (7), (8) and (9) in order to maintain the original size of the array. There are many other ways of approximating the derivative using finite differences. For points in x equidistant by h, a centered estimate for the first derivative of f(x) is f(x + h) - f(x - h) 21 One-sided estimates can be computed by I f'(x) = 3f(z) 4f (x - h) + f(x 21) 2h -3f(x) + 4f (x + h) - f(x + 2h) f'(z) = - 2h (9) Note that 2 points are need to compute a centered estimate and 3 points are need for one-sided estimates. 1. Write a function yp = MyDer (h,y) that takes in the x-spacing h, an array of data y and returns the first-order derivative yp of y using (7), (8) and (9) in order to maintain the original size of the array
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
