CCCPaste

Trapezoidal

function IT = trapezoidal(a, b, n)
    
    f = @(x) sqrt(1 - 0.162 * (sin(x) ^ 2));
    h = (b - a) / n;
    
    sum = 0;

    for i = 0 : n

        if i == 0 || i == n
            sum = sum + f(a + i * h);
        else
            sum = sum + 2 * f(a + i * h);
        end

    end

    IT = (sum * h) / 2;
end