You need to use more fine-grid X data in polyval to get test points at y=0.
xA_fine = linspace(xA(1),xA(end),100);
fA_fine = polyval(pA,xA_fine,,muA);
trapz( xA_fine, fA_fine )
idx = fA_fine>=0;
trapz( xA_fine(idx), fA_fine(idx) )
i = find(fA_fine>=0,1)
trapz( xA_fine(i:end), fA_fine(i:end) )
Also note: multiple ways to get values greater than zero. The first is to use logical indices, the second is to find the first place and integrate from there. The second only works when the function is always increasing. The first may run into problems if there are multiple y=0 cross-overs, depending on how xA_fine is defined.