Home /
Expert Answers /
Computer Science /
code-clearly-please-and-also-screenshot-the-matlab-code-nbsp-write-a-program-for-composite-quad-pa289
(Solved):
Code clearly please, and also screenshot the MATLAB
code.
Write a program for composite quad ...
Code clearly please, and also screenshot the MATLAB
code.
Write a program for composite quadrature using Simpson's rule. How many function evaluations are required to compute the integral of sin x over the interval [0, 1] and with a tolerance of 10-6? Use the value obtained with MATLAB's quad routine as the exact value of the integral.
function [Q,fcount] = quadtx(F,a,b,tol,varargin) %QUADTX Evaluate definite integral numerically. % Q = QUADTX(F,A,B) approximates the integral of F(x) % from A to B to within a tolerance of 1.e-6. % % Q = QUADTX(F,A,B,tol) uses tol instead of 1.e-6.