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);

Answers (2)

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

Categories

Find more on Programming in Help Center and File Exchange

Products

Release

R2022a

Asked:

on 29 Mar 2022

Edited:

on 29 Mar 2022

Community Treasure Hunt

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

Start Hunting!