The way you try to plot the integral may be not correct, for x0 you can compute the integral by using the integral fuction with repsect to theta. This code below may help you understand this well
x0 = 0:2:8;
cai= @(theta) ((4.*pi.*x0.*cos(theta).*sin(theta)...
xval = integral(cai, 0, pi,'ArrayValued',true);
Also, I fix an mismatch between your code and your provided function
In your code:
I change it to
which is correct with your given equation.