Error using Integral - IntegralCalc - Syms

2 views (last 30 days)
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)

Accepted Answer

Torsten
Torsten on 27 Apr 2017
Use
Acap11 = matlabFunction(Acap)
Best wishes
Torsten.
  5 Comments
Torsten
Torsten on 27 Apr 2017
Edited: Torsten on 27 Apr 2017
90° is in between 75° and 105°, and you integrate over the entire interval.
Note that x=1.5708 is approximately pi/2.
Best wishes
Torsten.

Sign in to comment.

More Answers (0)

Categories

Find more on Design and Simulate SerDes Systems in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!