1. Numerical Differentiation. In Lecture 5b we saw that the forward and backward difference approximations of a function f(x) incur error that scales linearly with the increment h, while the error of the
2-point central difference approximation scales quadratically with h. i.c. it is O(h2) Here you will
experiment a bit with these formulas.
(a) Follow the guidance in the lecture slides to implement your own MATLAB functions to numeri-
cally differentiate the function
by (i) the forward difference approximation, and (ii) the central difference approximation The
differentiation functions should call a separate function that evaluates equation (1). As with any
function, these must clearly describe what they do, what inputs they take, and what outputs they
(b) Using your functions from (a), write a script that computes the finite difference approximation at
100 points evenly spaced over the range 10. Choose several differencing increments h
over the range 10-16 515 10-1 (where h is varied on a log scale; see logspace), and compute
the average error of these finite difference approximations when compared to the exact derivative,
Construct a log-log plot of the average error vs. h over the range of h.
These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction
of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice.
Unethical use is strictly forbidden.
%We solve part A
%Setting the arbitrary values of step and original point
%Calculating derivatives using the diff function that contains to values of
%input function and step as an input and outputs the approximate value of
%We create array of values%
startValue = 1;
endValue = 10;
nElements = 100;
stepSize = (endValue-startValue)/(nElements-1);
A = startValue:stepSize:endValue;...