Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Need help writing Matlab code and please comment on the work so I could understand thank you Create a function called composite_simpsons that inputs a
Need help writing Matlab code and please comment on the work so I could understand thank you
Create a function called composite_simpsons that inputs a function, a pair of endpoints, a, b, and a number n, and outputs the approximation to the integral of f from a to b using the Composite Simpson's rule on n 1 points. Your function header should look like this function I composite_ simpsons (f,a,b, n) Use that function to compute the integral I cos ( ) dt, for the number of points r-103, 105. Call 13 and 14 the obtained resulbs. The exact answer to this integral can be computed using the Fresnel cosine integral in Matlab: fresne1c(x) = 0 cos ( t ) dt. 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 Err3 and Err4 those errors. Make a loglog plot of error verses the number of points. Comment on your results: which method works best between Trapezoid and Simpson's? Which method works the worst? Why? Write your answer as a comment usingStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started