Question: Please label all plots and tables and include any MATLAB scripts and functions with your solution. 1. Consider the following finite difference quotients (one-sided formula)

 Please label all plots and tables and include any MATLAB scripts

Please label all plots and tables and include any MATLAB scripts and functions with your solution. 1. Consider the following finite difference quotients (one-sided formula) (2+h)-f(x) ; (centered formula) mule f(x+h)-f(x - h) 2h each of which approximates the derivative f'(x) of a differentiable functions. Write MATLAB functions, with calling sequences (fp for f prime) fp = onesidediff(f,x,h) and fp = centerdiff(f,x,h), which evaluate these quotients on a vector x, given a scalar h and a general function f passed using the @ notation. Use both MATLAB functions to approximately com- pute the derivative of f(x) = (1+x2)-1 on (-1, 1) using x = linspace(-1,1,100) and h = le-4. Prepare the following plot with two subplots, using the subplot(2,1,1) and subplot(2,1,2) com- mands. The top plot should depict the error (in absolute value) on (-1, 1] between the one-sided approximation and the exact derivative, while the bottom plot should depict the error (in absolute value) on -1, 1 between the centered approximation and the exact derivative

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!