Hello,
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)...
+8.*pi.*cos(theta).*cos(theta).*sin(theta))...
./(1+0.5.*x0*cos(theta)));
xval = integral(cai, 0, pi,'ArrayValued',true);
plot(x0, xval)
grid
Also, I fix an mismatch between your code and your provided function
In your code:
./(1+0.5.*x0+cos(theta)));
I change it to
./(1+0.5.*x0*cos(theta)));
which is correct with your given equation.