Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3. You are given a function f(x 2r3r on the interval -2,2] and you want to calculate the first derivative of this function at the

image text in transcribed

3. You are given a function f(x 2r3r on the interval -2,2] and you want to calculate the first derivative of this function at the points on this interval. Write a MATLAB program that (a) Given the number N of subintervals, calculates the first derivative of the function, fi, at each point zi, including the boundary points, with the first-order accuracy (this can be done as a self-written MATLAB function). You can use any formula of O(h) of your choice. (b) Given the number N of subintervals, calculates the first derivative of the function, f, at each point r, including the boundary points, with the second-order accuracy (this can be done as a self-written MATLAB function). You can use any formula of O(h2) of your choice. (c) Calculates two measures of error defined as The first error is called the error in infinity norm (max stands for the maximum value among all the points), and the second error is called the error in L2 norm. Here f(i) is the true value of derivative at the given point Run your program with the number of intervals N equal to 8, 16, 32, 64 and document the E and El errors for each run. Plot EL versus N, in log-log plot, for both the O(h) and O(h2) derivatives on the same plot. Also, plot ELa versus N, in log-log plot, for both the O(h) and O(h2) derivatives (on the same plot, but different from ELerrors). Estimate the order of accuracy for each derivative from the two plots. Discuss if you obtain the expected order of convergence, for both error measures

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 And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 1 Lncs 13426

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124227, 978-3031124228

More Books

Students also viewed these Databases questions