MATLAB: How to solve this integration ???

MATLAB

>> c
c =
(x*cos(x)*sin(x))/(a^2*cos(x)^2 + b^2*sin(x)^2)^2
>> pretty(c)
x cos(x) sin(x)
--------------------------
2 2 2 2 2
(a cos(x) + b sin(x) )
>> int(c,0,(pi/2))
ans =
int((x*cos(x)*sin(x))/(a^2*cos(x)^2 + b^2*sin(x)^2)^2, x, 0, pi/2)
>> pretty(ans)
pi
--
2
/
| x cos(x) sin(x)
| -------------------------- dx
/ 2 2 2 2 2
0 (a cos(x) + b sin(x) )

Best Answer

This shows that MATLAB is not able to find a closed-form expression for the integration problem. You can still find the numerical answer by substituting the numeric values of a and b
syms x a b
c = (x*cos(x)*sin(x))/(a^2*cos(x)^2 + b^2*sin(x)^2)^2;
c_int = int(c, x, 0, pi/1);
x = subs(c_int, [a b], [1 2]);
This will give the value of integration at a=1, b=2. Result:
>> x
x =
-pi/12