Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please provide code. (20 pts. ) 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)]D2[f(x)]D3[f(x)]=hf(x)f(xh),=2hf(x+h)f(xh),=2h3f(x)4f(xh)+f(x2h). Each

image text in transcribedPlease provide code.

(20 pts. ) 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)]D2[f(x)]D3[f(x)]=hf(x)f(xh),=2hf(x+h)f(xh),=2h3f(x)4f(xh)+f(x2h). 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=10d where d=1, 2,,10. For each value of x, create a table of results with the headings h, D1error, D2error, and D3error. Hint: I would suggest creating the table in LATEXusing output from a MATLAB script that is at worst cut-and-paste ... i.e. do not type this in by hand

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 Systems A Practical Approach To Design Implementation And Management

Authors: THOMAS CONNOLLY

6th Edition

9353438918, 978-9353438913

More Books

Students also viewed these Databases questions