There is an error in the anonymous function in ‘A3’, and since MATLAB is case-sensitive, ‘Intfun’ is not the same as ‘intfun’. Also note that the functions for ‘A3’ and ‘A4’ are different.
This runs:
% Lobatto Quadrature
A3= quadl(@(x)3*x,x(1),x(end))
% Global adaptive quadrature
intfun=@(x) (3*x.^2)
A4=integral(intfun,x(1),x(end))
(I provided my own ‘x’ vector to test it.)