MATLAB: Matrix dimensions must agree.

matrix

i dont where the wrong in this equation:
function F = Fint(a)
F = quad(@(x)(x.*sin(x))./(1-(2.*a.*cos(x))+a.^(2)),0,pi);
end
where the output i got is
Matrix dimensions must agree.
Error in Fint>@(x)(x.*sin(x))./(1-(2.*a.*cos(x))+a.^(2)) (line 2)
F = quad(@(x)(x.*sin(x))./(1-(2.*a.*cos(x))+a.^(2)),0,pi);

Best Answer

To integrate a vector, use the quadv (link) function.
If you have R2012a or later, use integral (link) with the 'ArrayValued' option instead.