Look up Simpson’s Rule and explore the effect on this integration method of
changing the strip size on the error. Also, explore the effect of changing the strip size
in the left-hand and right-hand rules for integration. Compare the convergence of the
integral as the strip size decreases for all four integration methods.
My code is this ( I think that it is not completed and needs some modifications so please helllllllp)
clear; %Exploring the effect of strip size on error in the Trapezium Rule %I=dx((y0+yn/2)+ rest of y vaules) % a=0 b=5 f(x)=3x^2 Realans = 125 fnl = 75; N = input ('How many different strip sizes?') for J = 1:N dx(J) = (1/J); A = [0:(dx(J)):5]; fa = 3*A.*A; npts = length(A); Sum = 0; for I = 2:(npts-1) Sum = Sum + fa(I); end Integral(J) = dx(J)*((fnl/2)+ Sum); Error(J) = Integral(J) - Realans; end plot(dx,Error) title('Error in the Trapezium Rule') xlabel('Strip Size') ylabel('Error')