Integral error in the function

I do not know where to put dots so that the integral works
func=@(t) (t^((3/2)-1)*(exp(-t)));
Gamma=integral(func,0,Inf);
this are the errors
Error using ^ (line 52)
Incorrect dimensions for raising a matrix to a power. Check that the matrix is square and the power is a scalar. To perform
elementwise matrix powers, use '.^'.
Error in Rsphericalwave>@(t)(t^((3/2)-1)*(exp(-t))) (line 35)
func=@(t) (t^((3/2)-1)*(exp(-t)));
Error in integralCalc/iterateScalarValued (line 314)
fx = FUN(t);
Error in integralCalc/vadapt (line 132)
[q,errbnd] = iterateScalarValued(u,tinterval,pathlen);
Error in integralCalc (line 83)
[q,errbnd] = vadapt(@AToInfInvTransform,interval);
Error in integral (line 87)
Q = integralCalc(fun,a,b,opstruct);
Error in Rsphericalwave (line 36)
Gamma=integral(func,0,Inf);

Réponses (2)

KSSV
KSSV le 29 Mar 2022
func=@(t) (t.^((3/2)-1).*(exp(-t))); %<-- element by element operations
Gamma=integral(func,0,Inf)
Gamma = 0.8862
Torsten
Torsten le 29 Mar 2022
Modifié(e) : Torsten le 29 Mar 2022

0 votes

func = @(t) t.^0.5.*exp(-t);
Gamma = integral(func,0,Inf);

Catégories

En savoir plus sur Programming dans Centre d'aide et File Exchange

Produits

Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by