From: Muhammad on
Hi everyone,
I am trying to integrate the following function from 0 to infinity numerically in matlab:

f(x)= (x/(2*l*s))^0.5*(l-1) * (exp(-0.5*(x+2*l*s))) * besseli(l , sqrt(2*l*s*x)) * ...
gammainc(x , l)^(N-1);
My Matlab code is:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
N = 20 ;
K = 30;
l = round(K/N);
s = 30 ;
b = 1e6;
f = (x/(2*l*s))^0.5*(l-1) * (exp(-0.5*(x+2*l*s))) * besseli(l , sqrt(2*l*s*x)) * ...
gammainc(x , l)^(N-1);
pd = 0.5 * int(f,x,b,inf);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

But matlab gives following error while defining function f:

??? Undefined function or method 'lt' for input arguments of type 'sym'.
Error in ==> gammainc at 77
k = find(a ~= 0 & x ~= 0 & x < a+1);
Error in ==> reference_strat_roc at 21
f = (x/(2*l*s))^0.5*(l-1) * (exp(-0.5*(x+2*l*s))) * besseli(l , sqrt(2*l*s*x)) * gammainc(x , l)^(N-1);


How can I avoid this error or any other method to integrate this integral numerically???

Thanks

TAHIR
From: us on
On Jul 27, 3:02 pm, "Muhammad " <mtornad...(a)hotmail.com> wrote:
> Hi everyone,
> I am trying to integrate the following function from 0 to infinity  numerically in matlab:
>
> f(x)= (x/(2*l*s))^0.5*(l-1) * (exp(-0.5*(x+2*l*s))) * besseli(l , sqrt(2*l*s*x)) * ...
> gammainc(x , l)^(N-1);
> My Matlab code is:
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> N = 20 ;
> K = 30;  
> l = round(K/N);
> s = 30 ;
> b = 1e6;
> f = (x/(2*l*s))^0.5*(l-1) * (exp(-0.5*(x+2*l*s))) * besseli(l , sqrt(2*l*s*x)) * ...
>  gammainc(x , l)^(N-1);
> pd = 0.5 * int(f,x,b,inf);
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
> But matlab gives following error while defining function f:
>
> ??? Undefined function or method 'lt' for input arguments of type 'sym'.
> Error in ==> gammainc at 77
> k = find(a ~= 0 & x ~= 0 & x < a+1);
> Error in ==> reference_strat_roc at 21
> f = (x/(2*l*s))^0.5*(l-1) * (exp(-0.5*(x+2*l*s))) * besseli(l , sqrt(2*l*s*x)) * gammainc(x , l)^(N-1);
>
> How can I avoid this error or any other method to integrate this integral numerically???
>
> Thanks
>
> TAHIR

you don't show how X is defined...
the code works fine if(f) X is a DOUBLE...
however, accoding to the error message, it seems to be a symbolic
object...

us
From: Muhammad on
us <us(a)neurol.unizh.ch> wrote in message <79aac37d-9b9b-435f-8827-ecac84a0d5d8(a)t35g2000vbb.googlegroups.com>...
> On Jul 27, 3:02 pm, "Muhammad " <mtornad...(a)hotmail.com> wrote:
> > Hi everyone,
> > I am trying to integrate the following function from 0 to infinity  numerically in matlab:
> >
> > f(x)= (x/(2*l*s))^0.5*(l-1) * (exp(-0.5*(x+2*l*s))) * besseli(l , sqrt(2*l*s*x)) * ...
> > gammainc(x , l)^(N-1);
> > My Matlab code is:
> > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> > N = 20 ;
> > K = 30;  
> > l = round(K/N);
> > s = 30 ;
> > b = 1e6;
> > f = (x/(2*l*s))^0.5*(l-1) * (exp(-0.5*(x+2*l*s))) * besseli(l , sqrt(2*l*s*x)) * ...
> >  gammainc(x , l)^(N-1);
> > pd = 0.5 * int(f,x,b,inf);
> > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> >
> > But matlab gives following error while defining function f:
> >
> > ??? Undefined function or method 'lt' for input arguments of type 'sym'.
> > Error in ==> gammainc at 77
> > k = find(a ~= 0 & x ~= 0 & x < a+1);
> > Error in ==> reference_strat_roc at 21
> > f = (x/(2*l*s))^0.5*(l-1) * (exp(-0.5*(x+2*l*s))) * besseli(l , sqrt(2*l*s*x)) * gammainc(x , l)^(N-1);
> >
> > How can I avoid this error or any other method to integrate this integral numerically???
> >
> > Thanks
> >
> > TAHIR
>
> you don't show how X is defined...

Sorry for my mistake. Yes you are right .... x is defined as

syms x ;

Please give any suggestion how to evaluate this integral .....

Thanks

> the code works fine if(f) X is a DOUBLE...
> however, accoding to the error message, it seems to be a symbolic
> object...
>
> us
From: us on
"Muhammad "
> Sorry for my mistake. Yes you are right .... x is defined as
>
> syms x ;
>
> Please give any suggestion how to evaluate this integral .....
>
> Thanks

according to the title of your OP, you're looking for numerical integration...
since INT() works on syms, you'd have to look into other ML functions, eg,

help quad; % <- and its many siblings...

us
From: Muhammad on
"us " <us(a)neurol.unizh.ch> wrote in message <i2mmef$mua$1(a)fred.mathworks.com>...
> "Muhammad "
> > Sorry for my mistake. Yes you are right .... x is defined as
> >
> > syms x ;
> >
> > Please give any suggestion how to evaluate this integral .....
> >
> > Thanks
>
> according to the title of your OP, you're looking for numerical integration...
> since INT() works on syms, you'd have to look into other ML functions, eg,
>
> help quad; % <- and its many siblings...
>
> us


Thanks for reply. But quad() and its versions work on scalar limits of integration but I have to evaluate the integral from a positive scalar to infinity. ???