how to find integral for this function

2 views (last 30 days)
v s ramcharan peddireddi
v s ramcharan peddireddi on 29 Jun 2016
Edited: Jan Orwat on 29 Jun 2016
this is the actual function
i coded it as fallows fun1=@(x)((sqrt(((tan(pi*x/2))/(pi*x/2))*((0.923+(0.199*(1-sin((pi*x)/2))^4)))/cos((pi*x)/2)))^2)
but i'm getting so many errors like
Error using ^ Inputs must be a scalar and a square matrix. To compute elementwise POWER, use POWER (.^) instead.
Error in Ccbeam>@(x)(mpower((sqrt(((tan(pi*x/2))/(pi*x/2))*((0.923+(0.199*(1-sin((pi*x)/2))^4)))/cos((pi*x)/2))),2)) (line 47) fun1=@(x)(mpower((sqrt(((tan(pi*x/2))/(pi*x/2))*((0.923+(0.199*(1-sin((pi*x)/2))^4)))/cos((pi*x)/2))),2))
Error in integralCalc/iterateScalarValued (line 314) fx = FUN(t);
Error in integralCalc/vadapt (line 133) [q,errbnd] = iterateScalarValued(u,tinterval,pathlen);
Error in integralCalc (line 76) [q,errbnd] = vadapt(@AtoBInvTransform,interval);
Error in integral (line 89) Q = integralCalc(fun,a,b,opstruct);

Answers (1)

Jan Orwat
Jan Orwat on 29 Jun 2016
Edited: Jan Orwat on 29 Jun 2016
In MATLAB there is a difference between calling * and .* The same is for ^ .^ etc.
  • * to .*
  • / to ./
  • ^ to .^


Find more on Matrix Computations 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!