Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please use Matlab R2019a code to write a step by step solution program to the following question. This is all the information that was given.

Please use Matlab R2019a code to write a step by step solution program to the following question. This is all the information that was given.

image text in transcribed

3. (40 Points) Construct an algorithm in a function named simpsons7 that takes three inputs; a function handle, the lower bound of the integration and the upper bound of the integration. The function should compute and output the three different approximations of an integral using exactly seven segments. You may call simpson 13 and simpson38 as sub-functions (you must include this in the header). Compute the integral below using each of the methods listed below: (0.075x5 +0.6x* +0.2x2 +0.5) dx (a) Create a table with the Method, Value, and MTPRE (magnitude of the true percent relative error) for each of the methods below. Include 4 digits to the right of the decimal point in all numbers. Create an anonymous function to calculate the MTPRE (Do NOT put a semicolon at the end). The table should look like the one below. Note that the in the last three lines of the table is a dash (not a minus sign). Method Value MTPRE Exact TrapSingle Simpsons 1/3 Simpsons 3/8 TrapComposite s13 - S13 - S38 S38 - S13 - 313 s13 - S38 - 513 88.3458 xxxx.xxxx xxxx.xxxx xxxx.xxxx xxxx.xxxx xxxx.xxxx xxxx.xxxx xxxx.xxxx xxx.xxxx xxx.xxxx xxx.xxxx xxx. XXXX xxx.xxxx XXX.XXXX xxx.xxxx i. Using an anonymous function defined to be the indefinite integral. For example, for f(x) = x2, the function is g(x) = x. Then the exact or true value of the integral can be computed as I true = g(b)-ga) where a and b are the limits of integration. Do not include a semicolon at the end of the definition of the anonymous function. Do not use the Matlab int function or any similar function ii. A single application of the trapezoidal rule ili. A composite application of the trapezoid rule with n=7 Page 2 of 3 iv. A single application of the Simpson's 1/3 rule v. A single application of the Simpson's 3/8 method, and vi. Three approximations using the composite simpson7 function you created. 3. (40 Points) Construct an algorithm in a function named simpsons7 that takes three inputs; a function handle, the lower bound of the integration and the upper bound of the integration. The function should compute and output the three different approximations of an integral using exactly seven segments. You may call simpson 13 and simpson38 as sub-functions (you must include this in the header). Compute the integral below using each of the methods listed below: (0.075x5 +0.6x* +0.2x2 +0.5) dx (a) Create a table with the Method, Value, and MTPRE (magnitude of the true percent relative error) for each of the methods below. Include 4 digits to the right of the decimal point in all numbers. Create an anonymous function to calculate the MTPRE (Do NOT put a semicolon at the end). The table should look like the one below. Note that the in the last three lines of the table is a dash (not a minus sign). Method Value MTPRE Exact TrapSingle Simpsons 1/3 Simpsons 3/8 TrapComposite s13 - S13 - S38 S38 - S13 - 313 s13 - S38 - 513 88.3458 xxxx.xxxx xxxx.xxxx xxxx.xxxx xxxx.xxxx xxxx.xxxx xxxx.xxxx xxxx.xxxx xxx.xxxx xxx.xxxx xxx.xxxx xxx. XXXX xxx.xxxx XXX.XXXX xxx.xxxx i. Using an anonymous function defined to be the indefinite integral. For example, for f(x) = x2, the function is g(x) = x. Then the exact or true value of the integral can be computed as I true = g(b)-ga) where a and b are the limits of integration. Do not include a semicolon at the end of the definition of the anonymous function. Do not use the Matlab int function or any similar function ii. A single application of the trapezoidal rule ili. A composite application of the trapezoid rule with n=7 Page 2 of 3 iv. A single application of the Simpson's 1/3 rule v. A single application of the Simpson's 3/8 method, and vi. Three approximations using the composite simpson7 function you created

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

Learning PostgreSQL

Authors: Salahaldin Juba, Achim Vannahme, Andrey Volkov

1st Edition

178398919X, 9781783989195

More Books

Students also viewed these Databases questions

Question

2 What are the implications for logistics strategy?

Answered: 1 week ago