Question: Numerical methodsWrite a user - defined function in MatLab that applies the Ridders interpolation method for calculating derivatives. The function should be called [ a

Numerical methodsWrite a user-defined function in MatLab that applies the Ridders interpolation method for
calculating derivatives. The function should be called [a,df]=
DerivativeRidders (func,x,h, err), where a is the Romberg matrix, df is the
derivatrive, func is the function defined with function handle (@),x is the value at which the
derivative is required, h is the step and err is the error. For the derivative the function should
use the two-point central difference scheme. If the err is not defined, the function should select
automatically er r=10-7. If h=0, the function should show a message 'h must be nonzero'. The
error should be calculated as the maximum value compared with the previous two values [e.g.
for the case of B1 the error should be the max(abs(B1-A2), abs(B1-A1)), see lecture slides].
Use also format long in the function so that you see as many digits as possible. The size of
the Romberg matrix should be fixed to number 5. The only build-in functions of MatLab you
are allowed to use are: nargin, feval, max, abs, disp. After building the function use it to
estimate the derivative of function:
f(x)=exsin(x)-x2
at x=1, with h=0.01. Report the results and submit with the MatLab files. (30%)
 Numerical methodsWrite a user-defined function in MatLab that applies the Ridders

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!