Question: MATLAB CODE integrand = @(x) (2/sqrt(pi))*exp(-x.^2); Using two nemerical integration approaches to evaluate this integral and generate values for a table. 1. Composite trapezoid rule
MATLAB CODE
integrand = @(x) (2/sqrt(pi))*exp(-x.^2);
Using two nemerical integration approaches to evaluate this integral and generate values for a table.
1. Composite trapezoid rule (cumtrapz)
2. 3 point gauss-legendre quadrature
Input: a column vector of one or more x values at which erf(x) is to be computed
output1: estimates for erf(x) calculated using composite trapezoid rule between 0 and each of elements in x. Evaluate the integrand at 0 and at the input x values to comput y values. The lower limit 0 must be evaluated.
output2: estimates for erf(x) calculated using 3- point Gauss-Legendre quadrature. Work by hand to develop the shifted integrand( in terms of x_d) and use the appropriate constants and function evaluations.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
