Write a MATLAB function cobweb that plots a cobweb diagram to visualise the iterations per-
formed by an iterative method of the form
xn+1 = g(xn).
the cobweb function should take as its inputs a function handle g of a function that implements
g, an initial estimate x0, the number of iterations to perform numits, values xmin, xmax, ymin
and ymax, and a one dimensional array ud. The function g may be undefined or discontinuous
at a finite number of points between xmin and xmax. The first entry of ud will contain the
number of points between xmin and xmax at which g is undefined or discontinuous. The
remaining entries of ud will contain these points in increasing order. The function should
plot y = x in red and y = g(x) in blue. The horizontal axis should be labelled x and the
vertical axis should be labelled y. A legend which identifies y=x and y=g(x) should be on
your plot. The axes should then be adjusted so that the horizontal axis goes from xmin to
xmax and the vertical axis goes from ymin to ymax. Henceforth, the range of the axes and
the legend should not change. Your cobweb function should then plot vertical and horizontal
lines in black to visualise the iterations performed by the iterative method
xn+1 = g(xn).
Before plotting each horizontal and vertical line your function should wait for 1 second. The
function should not print anything in the command window.