Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Matlab: Please leave comments in your code and show screenshots of the plots . Also here is integrand.m code/download. Problem 1: Composite Simpson's Rule Simpson's

image text in transcribedimage text in transcribedimage text in transcribed

Matlab: Please leave comments in your code and show screenshots of the plots. Also here is integrand.m code/download.

image text in transcribedimage text in transcribedimage text in transcribed
Problem 1: Composite Simpson's Rule Simpson's 1/3 Rule approximates the integral as: [ f() dx = ? If (x. ) + 4f ( x,) + f (x2 )]. The formula is derived by approximationg the integrand with the interpolating quadratic polynomial. The closed form of the composite Simpson's rule is defined with respect to an even number of subintervals, n, as follows: Problem 1.1: Write a function 'compSimp.m' that takes as input an even number of subintervals, n, and the interval endpoints a and b, and returns the integral approximation value for the function encoded in 'integrand.m'. (Note: n must be even for this formula. Your code should check that the input n is even). Problem 1.2: Download 'integrand.m', which encodes the function we wish to integrate. Write a function 'compSimEval.m' that first calls your 'compSimp' function to integrate 'integrand' with n = 12, a =0, and b = 1; Next, compute the relative error of your approximation using the solution from Matlab's "integral' function as the 'true solution'. Finally, generate a plot of 'integrand' that states your approximate integral value and the relative error in the title. It should look something like this: 2.4 E. Castillo: compSimp = 1.462660, relative error = 0.000010 2A 24 18 1.0 1.4 12 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.9Problem 1.1 o 'compSimp.m' Function Complete Header and commented code (5 Points) Correct approach for composite Simpson's (5 Points) Correct indexing for composite Simpson's (5 Points) Problem 1.2 o compSimEval.m Correct implementation of 'integral' and relative error (3 Points) Correct plot (2 Points)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Investment Analysis and Portfolio Management

Authors: Frank K. Reilly, Keith C. Brown

10th Edition

978-0538482387

Students also viewed these Mathematics questions