I am getting error in integrating a function from 0 to infinity wrt x. Kindly help.

3 vues (au cours des 30 derniers jours)
CODE:
fun=@(x) (p*q*r*exp(-x*d/sqrt(a*b)));
rx=integral(fun,0,Inf)
Msq=pi*u*sqrt(a*b)*rx
% where variables p, q, r, d, a and b are defined
ERROR:
Error using *
Inner matrix dimensions must agree.
Error in @(x)(p*q*r*exp(-x*d/sqrt(a*b)))
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 88)
Q = integralCalc(fun,a,b,opstruct);
Error in SaadMutashar (line 83)
rx=integral(fun,0,Inf)
  3 commentaires
Andrei Bobrov
Andrei Bobrov le 24 Jan 2019
Modifié(e) : Andrei Bobrov le 24 Jan 2019
What is p, q, r, d, a and b? Please attach mat-file with your variables.
Swathi S
Swathi S le 24 Jan 2019
Sir, I have attached the mat-file.

Connectez-vous pour commenter.

Réponse acceptée

Andrei Bobrov
Andrei Bobrov le 24 Jan 2019
Try
q = integral(fun,0,Inf,'ArrayValued',1);
but in your case the result is a zero vector, due to value of the gamma = 0.
  1 commentaire
Swathi S
Swathi S le 24 Jan 2019
Sir, I used the below code and am able to clear the error.
syms x
q=int(fun,x,0,Inf).
Yes its 0 vector due to gamma=0. I think I have to change the gamma value now. Thank you sir for your answer.

Connectez-vous pour commenter.

Plus de réponses (1)

Torsten
Torsten le 24 Jan 2019
q=integral(fun,0,Inf,'ArrayValued',true)

Catégories

En savoir plus sur Gamma Functions dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by