Verdan - in your code, the mB and a are scalars whereas you want them to be arrays (for when you plot outside of the loop). Try doing
xData = 1:1:20;
a = size(xData);
for mB = xData
NB = mB*g*cosd(theta); % I moved this here since it depends upon mB
a(mB) = ((mA)*(g)*(sind(theta)) - (muA)*(NA) + (mB)*(g)*(sind(theta)) - (muB)*(NB)) / (mA + mB);
end
plot(xData,a);