MATLAB: Error using Integral – IntegralCalc – Syms

integralintegralcalcsymbolicsyms

Hi, This is my Code
clc
clear all
syms Th
th1=5*pi/12 ;
th2=7*pi/12;
A11= @(Th) (10279222485063723*cos(Th).^2)/2684354560000 + (9*((7138348947960919*cos(Th).^2)/8589934592 + 1142135831673747/4294967296))/(625*cos(Th).^2)
A11Bar=integral(A11,th1,th2)
Acap =(10279222485063723*cos(Th).^2)/2684354560000 + (9*((7138348947960919*cos(Th).^2)/8589934592 + 1142135831673747/4294967296))/(625*cos(Th).^2)
Acap11 = @(Th) Acap
Acap11Bar=integral(Acap11,th1,th2)
I am trying to Integrate the Equation in A11 with limits th1 and th2. Using the Integral command, If I am using the equation directly it gives me the answer. But if Define the equation as Acap, Acap becomes symbolic and I dont get answer and the error comes as follows. My Question is , Th is a sym, but I get the answer for A11Bar, when using Th in A11, But why not the same in the other case.
A11 =
@(Th)(10279222485063723*cos(Th).^2)/2684354560000+(9*((7138348947960919*cos(Th).^2)/8589934592+1142135831673747/4294967296))/(625*cos(Th).^2)
A11Bar =
4.090565444758960e+04
Acap =
(2569805621265931*cos(Th)^2)/671088640000 + ((64245140531648271*cos(Th)^2)/8589934592 + 10279222485063723/4294967296)/(625*cos(Th)^2)
Acap11 =
@(Th)Acap
Error using integralCalc/finalInputChecks (line 511) Input function must return 'double' or 'single' values. Found 'sym'.
Error in integralCalc/iterateScalarValued (line 315) finalInputChecks(x,fx);
Error in integralCalc/vadapt (line 132) [q,errbnd] = iterateScalarValued(u,tinterval,pathlen);
Error in integralCalc (line 75) [q,errbnd] = vadapt(@AtoBInvTransform,interval);
Error in integral (line 88) Q = integralCalc(fun,a,b,opstruct);
Error in Untitled (line 13) Acap11Bar=integral(Acap11,th1,th2)

Best Answer

Use
Acap11 = matlabFunction(Acap)
Best wishes
Torsten.