Write a user-defined MatLab function I=Simp38(FunName,a,b) using the composite Simpson's 3/8 method. FunName is a handle function that calculates the value of the function to be integrated, a and b are the limits of integration and I is the value of the integral. The function should calculate the value of the integral in iterations. In the first iteration the interval [a,b] is divided in two subintervals and in every iterations that follows the number of subintervals should be doubled. Stop the iterations when the difference in the value between two successive iterations is smaller than 1%.
Write a user-defined MatLab function I=Simp38(FunName,a,b) using the composite Simpson's 3/8 method. FunName is a handle function that calculates the value of the function to be integrated, a and b are the limits of integration and I is the value of the integral. The function should calculate the value of the integral in iterations. In the first iteration the interval [a,b] is divided in two subintervals and in every iterations that follows the number of subintervals should be doubled. Stop the iterations when the difference in the value between two successive iterations is smaller than 1%.
Step by step
Solved in 2 steps
Hello
There are little errors
It shows that:
Insufficient number of input parameters.
error (line 9)
h = (b - a) / n; % width of each subinterval