Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Let f(x) = sin(x) cos(x). (a) Construct MATLAB functions to approximate the derivative of f(x) using the following three formulae: D1 [f(x)] = (f(x +

Let f(x) = sin(x) cos(x).

(a) Construct MATLAB functions to approximate the derivative of f(x) using the following three formulae:

D1 [f(x)] = (f(x + h) f(x)) / h ,

D2 [f(x)] = (f(x + h) f(x h)) / 2h ,

D3 [f(x)] = (f(x + 2h) + 4f(x + h) 3f(x)) / 2h .

Each of your MATLAB functions should accept x and h as arguments and produce an approximate derivative as output. Also construct a separate MATLAB function to evaluate the exact derivative f'(x).

(b) Using your MATLAB functions, calculate the relative errors for the approximate derivatives at the points x = 0 and x = 0.6. Use values of h given by h = 10^-d where d = 1, 2, . . ., 10. For each value of x, create a table of results with the headings h, D1error, D2error, and D3error.

(c) Provide an explanation of the various behaviors that you observe. Hint, look at the values of h where each approximation yields the most accurate result.

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

Transactions On Large Scale Data And Knowledge Centered Systems Vi Special Issue On Database And Expert Systems Applications Lncs 7600

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Stephen W. Liddle ,Klaus-Dieter Schewe ,Xiaofang Zhou

2012th Edition

ISBN: 3642341780, 978-3642341786

More Books

Students also viewed these Databases questions