Use the Matlab function, integral(·) to numerically integrate the function, y=x2 −2x−4 from1to5.Youwillhavetocreateafunctionandpassafunction
handle to quad(·). See Attaway 14.5. (Answer = ~4/3)
Write a function using “for-loops” to integrate the mathematical function in Problem #1 using Rectangular integration. Use “Left-corner” Rectangular Integration. The function should take as inputs, a, b, N and a function handle and output the integrated result. (try N=1000) (Answer = ~4/3)
Using “for-loops”, integrate the same function in Problem #1 using Trapezoidal integration. Use the same function structure as in Problem #2. (Answer = ~4/3)
Using “for-loops”, integrate the same function in Problem #1 using Simpson’s 1/3 and 3/8 Rule integration. Use the same function structure as in Problem #2. (try N=100) (Answer = ~4/3)
Write three different functions using “for-loops” to integrate the Gaussian normal distribution curve from [-σ, σ ], [-2σ, 2σ ], and [-3σ, 3σ ], using Rectangular integration. Perform all three types of Rectangular integration: 1) Left-corner; 2) Midpoint and 3) Right-corner. Use the same function structure as in Problem #2. Let μ be 0 and let σ be 1. (try N=1000)
(Answer = ~68.2%,~95.4%,~99.7%)