how to find integral for this function

1 visualizzazione (ultimi 30 giorni)
v s ramcharan peddireddi
v s ramcharan peddireddi il 29 Giu 2016
Modificato: Jan Orwat il 29 Giu 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);

Risposte (1)

Jan Orwat
Jan Orwat il 29 Giu 2016
Modificato: Jan Orwat il 29 Giu 2016
In MATLAB there is a difference between calling * and .* The same is for ^ .^ etc.
Change
  • * to .*
  • / to ./
  • ^ to .^

Categorie

Scopri di più su Linear Algebra in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by