Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please label all plots and tables and include any MATLAB scripts and functions with your solution. 1. Consider the following finite difference quotients (one-sided formula)

image text in transcribed

Please label all plots and tables and include any MATLAB scripts and functions with your solution. 1. Consider the following finite difference quotients (one-sided formula) (2+h)-f(x) ; (centered formula) mule f(x+h)-f(x - h) 2h each of which approximates the derivative f'(x) of a differentiable functions. Write MATLAB functions, with calling sequences (fp for f prime) fp = onesidediff(f,x,h) and fp = centerdiff(f,x,h), which evaluate these quotients on a vector x, given a scalar h and a general function f passed using the @ notation. Use both MATLAB functions to approximately com- pute the derivative of f(x) = (1+x2)-1 on (-1, 1) using x = linspace(-1,1,100) and h = le-4. Prepare the following plot with two subplots, using the subplot(2,1,1) and subplot(2,1,2) com- mands. The top plot should depict the error (in absolute value) on (-1, 1] between the one-sided approximation and the exact derivative, while the bottom plot should depict the error (in absolute value) on -1, 1 between the centered approximation and the exact derivative

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 Processing Fundamentals Design

Authors: Marion Donnie Dutton Don F. Seaman

14th Edition Globel Edition

1292107634, 978-1292107639

More Books

Students also viewed these Databases questions

Question

1. Ask students to include a rationale for their selections.

Answered: 1 week ago