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

조회 수: 3 (최근 30일)
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
Andrei Bobrov
Andrei Bobrov 2019년 1월 24일
편집: Andrei Bobrov 2019년 1월 24일
What is p, q, r, d, a and b? Please attach mat-file with your variables.

댓글을 달려면 로그인하십시오.

채택된 답변

Andrei Bobrov
Andrei Bobrov 2019년 1월 24일
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
Swathi S
Swathi S 2019년 1월 24일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Torsten
Torsten 2019년 1월 24일
q=integral(fun,0,Inf,'ArrayValued',true)

카테고리

Help CenterFile Exchange에서 Gamma Functions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by