MATLAB: Symbolic integrating only one variable of three

integratesphericalsymbolic expression

Hellow every one. I have one function with three variables. Variables typicaly are x,y,z where y=0 but in function i am using spherical coordinates which i have define in the begining of my code. I have one extra variable th1 which i want to integrate and the new function will have only x,z(r,th in spherical ). My problem is i cannot do that because when i run this:
syms x z th1;
r=(x^2 + z^2)^0.5;
th=acos(z/r);
d=2;
a=1;
d1=(a^2)/d;
L=1.5;
R1=(r^2 + d^2 - 2*r*d*(cos(th)*cos(th1) + sin(th)*sin(th1)))^0.5;
R2=(r^2 + d1^2 - 2*r*d1*(cos(th)*cos(th1) + sin(th)*sin(th1)))^0.5;
F1=d/R1;
F2=-(a/R2);
a1=-L/d;
a2=L/d;
f=@(x,z,th1)(F1+F2)
g = @(x,z) integral(@(th1) f(x,z,th1) , a1,a2)
I get :
f =
function_handle with value:
@(x,z,th1)(F1+F2)
I just want the symbolic expression of the above integration. I am stuck a lot of hours looking in already answered post but nothing so far. thanks in advance.

Best Answer

f = matlabFunction(F1+F2, 'vars', [x, z, th1]);
It turns out there is a closed form solution for g, but it is long and a bit complicated, and MATLAB cannot find it.
Related Question