Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MATLAB function Dnum = RichardsonDiff(f,x0,h,max1) % Differentiation algorithm based on Richardson extrapolation % f - string input for function y = f(x) % x0 -

MATLABimage text in transcribed

function Dnum = RichardsonDiff(f,x0,h,max1)

% Differentiation algorithm based on Richardson extrapolation

% f - string input for function y = f(x)

% x0 - value, where the derivative f'(x0) is to be found

% h - minimal step size, all other values are computed for the step sizes 2^(k-1) h

% max1 - maximal number of Richardson iterations

% Dnum - row-vector of numerical (central) derivatives:

% the entry with index k in Dnum corresponds to the derivative of order O(h^(2k))

D = ones(max1,max1); % the matrix for Richardson derivatives

for k = 1 : max1

x = x0 + 2^(k-1)*h;

f1 = feval(f);

x = x0 - 2^(k-1)*h;

f2 = feval(f);

D(k,1) = (f1-f2)/(2^k*h); % first approximation for the central difference

end

for k = 2 : max1 % compute k-th order central differences

for kk = 1 : (max1-k+1) % the matrix of Richardson derivatives is triangular!

D(kk,k) = D(kk,k-1)+(D(kk,k-1) - D(kk+1,k-1))/(4^(k-1)-1); % see the Richardson algorithm

end

end

% define the vector Dnum for numerical difference approximations

Dnum = D(1,:);

Use the following code to compute the derivative of sin(xA2+(1/3)x) at x- 0 Use h= 10-2, and perform extrapolation up to the tenthrder. Show the intermediate values D(m, n) in a table. Use the following code to compute the derivative of sin(xA2+(1/3)x) at x- 0 Use h= 10-2, and perform extrapolation up to the tenthrder. Show the intermediate values D(m, n) in a table

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_2

Step: 3

blur-text-image_3

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 Design Implementation And Management

Authors: Peter Robb,Carlos Coronel

5th Edition

061906269X, 9780619062699

Students also viewed these Databases questions

Question

=+ a. a family deciding whether to buy a new car

Answered: 1 week ago

Question

=+10. How are inflation and unemployment related in the short run?

Answered: 1 week ago