Question: 39. The first derivative of a function at a point can be approximated with the four-point central difference formula: where h is a small number

39. The first derivative of a function at a point can be approximated with the four-point central difference formula:

where h is a small number relative to . Write a user-defined function function (see Section 7.9) that calculates the derivative of a math function by using the four-point central difference formula. For the user-defined function name, use dfdx=FoPtder(Fun,x0), where Fun is a name for the function that is passed into FoPtder, and x0 is the point where the derivative is calculated. Use in the four-point central difference formula. Use the user-defined function FoPtder to calculate the following:

(a) The derivative of at .

(b) The derivative of at .
In both cases compare the answer obtained from FoPtder with the analytical solution (use format long).

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 Systems Analysis And Design Using MATLAB Questions!

Q:

a