Develop an m-file function to evaluate the centered


Problem

MATLAB

(a) Develop an M-file function to evaluate the centered finite-difference approximations, starting with x = 0.5. Thus, for the first evaluation, the x values for the centered difference approximation will be x = 2 ± 0.5 or x = 1.5 and 2.5. Then, decrease in increments of 0.1 down to a minimum value of x = 0.01.

(b) Repeat part (a) for the second-order forward and backward differences. (Note that these can be done at the same time that the centered difference is computed in the loop.)

(c) Plot the results of (a) and (b) versus x. On the same plot also show the true value of the derivative for the range of 0 to 0.5.

Use the follwing formulas:

Centered Diff: df/dx = (f(i+1) - f(i-1)) / 2dx

Forward Diff: df/dx = (-f(i+2) + 4f(i+1) - 3f(i)) / 2dx

Backward Diff: df/dx = (3f(i) - 4f(i-1) + f(i-2)) / 2dx.

Request for Solution File

Ask an Expert for Answer!!
Business Management: Develop an m-file function to evaluate the centered
Reference No:- TGS02780954

Expected delivery within 24 Hours