Develop a user-defined MatLab function I =Comptrapez(FunName,a,b) of integrating a function by using the composite trapezoidal 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%. Thank you very much
Develop a user-defined MatLab function I =Comptrapez(FunName,a,b) of integrating a
function by using the composite trapezoidal 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%.
Thank you very much
Step by step
Solved in 4 steps
Hello,there are some errors
Error: Line: 52 Column: 13
All functions in a script must end with 'end'.