comp.soft-sys.matlab - The MathWorks calculation and visualization package.
Symbolically you can do an infinite interval. Numerically the doubly infinite integral can be computed using Hermite quadrature. The [0,inf] integral can be done with Laguerre, or a mapping of some Jacobi-Radau quadrature. -G Peter Spellucci wrote: > > > > In article < XXXX@XXXXX.COM >, > hnliuhy < XXXX@XXXXX.COM > writes: > >Hi, > >How to calculate the integrand for a function from 0 to infinity. > > > >for example > > > >g=inline('exp(-2*x)'); > >quad(g, 0, infinity) ; % don't know how to do > > % this, so, here I just put > > % as infinity. > > > >By the way, if > > > >g=inline('exp(-b*x)'); > > > >with b unknown, how can I obtain the integrand as a function b by > >integrate g over x? > > > >Thanks alot > > g=inline('exp(-b*x)','x','b'); > quad(g,0,xend,,b); %b is an "additional parameter" > you cannot integrate over an infinite interval in matlab. use the > transformation > of variables > z=1/(x-x0+1) > for an integral from x0 to infinity . this takes that interval into > [0,1] > normally, you now have a singularity at z=0. hence again, current > matlab > integrators will not work, but you can have easily one yourself, > taking > quadl and exchanging the Lobatto nodes by ordinary Gauss nodes. > needsa little fiddling around, since the interval refinement needs > some > modification. > hth > peter >
Hi. i have 3 functions 1st: my_fun1.m 2nd: my_fun2.m 3rd: main.m and in main.m : fragment of code: ... ... ... try if my_fun1 == my_fun2 a=1; else b=0; end catch a=0; end; ... ... %%%%%% but is still one problem, if in my_fun1 or my_fun2 is: c=1; while c>0 end in this situation main function will work infinity:( what can i do in this situation, what should i write in main function??
Hello everyone, I am trying to do a 2D integration in Matlab, and my integrand is so complicated that it is not possible to vectorize it in a straightforward way, so I have to write a for loop to force the integrand to accept a vector x and a scalar y, which in Matlab will cause huge slow in speed. I am wondering if anyone is aware of how to deal with such problems in Matlab? Many thanks! Jun
I encounter an multiple value integrand in some optimization problem, which has the similar forms as follows: F(z1, z2, z3) = exp(-(z1+z2+z3-mu)^2)*exp(-(z2+z3-mu)^2)*exp(-(z3-mu)^2) given the bounds of z1, z2 and z3, how to solve the multiple integration of this integrand in matlab?