Question: (a) Write a MATLAB program to compute the derivative of f(x)=cos x at x=pi/6 using the forward, backward, and central difference formula. Use the step
(a) Write a MATLAB program to compute the derivative of f(x)=cos x at x=pi/6 using the forward, backward, and central difference formula. Use the step size h=10^-n for n=1, ...., 5. Make a table for each method which includes the values of derivatives, errors, and ratios of consecutive errors.
(b) Next, compute the derivative using smaller step size h=10^-n for n=6,...,14. Recall that numerical instabilities occur for h
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
