Question: Need help writing Matlab code and please comment on the work so I could understand thank you Create a function called composite trapezoid that inputs
Need help writing Matlab code and please comment on the work so I could understand thank you

Create a function called composite trapezoid that inputs a function, a pair of endpoints, a, b, and a number n of subintervals, and outputs the approximation to the integral of f from a to b using the composite trapezoid rule. Your function header should look like this function Icomposite_trapezoid(f,a, b,n) Use that function to compute the integral I Call I1 and I2 the obtained results. The exact answer to this integral can be computed using the o cos (1 ) dt, for the number of points n = 10, 105 - Fresnel cosine integral in Matlab: fresnelcx)cdt. Cody Coursework might not recognize this function, compute the value on Matlab and copy the result with the LONG format. Compute the error in your computation for each n and for each method. Call Errl and Err2 those errors. Make a loglog plot of error verses the number of points for both methods on the same plot. Comment on the result using % r cos ( ) dt. Cody Courseuork might not recognize you ou o
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
