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.
Swathi S
Swathi S 2019 年 1 月 24 日
Sir, I have attached the mat-file.

サインインしてコメントする。

採用された回答

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 Center および File ExchangeGamma Functions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by