MATLAB: Integration of the zero function handle ie f(x)=@(x) 0

function handleintegralintegration

I have a function that requires the integration of many functions and sometime that function is zero but I don't really know when that will be…. Unfortunately, integral(@(x)0,0,1) returns the following error; Output of the function must be the same size as the input. If FUN is an array-valued integrand, set the 'ArrayValued' option to true. How do I get around this? Any help would be great!!
Thanks
Drew

Best Answer

integral(@(x) 0 * x, 0, 1)
or
integral(@(x) zeros(size(x)), 0, 1)