Question: Homework Problem 2: Higher Order Numerical Differentiation In Exercise 2 you implemented a one-sided estimate for the derivative of a function f (x) using diff.

 Homework Problem 2: Higher Order Numerical Differentiation In Exercise 2 youimplemented a one-sided estimate for the derivative of a function f (x)

Homework Problem 2: Higher Order Numerical Differentiation In Exercise 2 you implemented a one-sided estimate for the derivative of a function f (x) using diff. One of the downsides of this quick method is the reduction in size of the arrays There are many other ways of approximating the derivative using finite differences. For points in r equidistant by h, a centered estimate for the first derivative of f (x) is 2h One-sided estimates can be computed by f (x) 2h f(x) 2h 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. For example, let f(x)-ln(x) so f,(x) = 1/x: >> y =0(x) log(x) ; h = 0.1; x = 1:h:3; yp - MyDer(h,y(x)); plot(x,yp,x,1./x, '--')

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!