Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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%)
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions

Question

What is the purpose of a cash flow hedge?

Answered: 1 week ago