#marcumq
function for Scilab
This function calculates Marcum's Q function.
Q_M(a,b) = 1/a^(m-1) \int_{b}^{\inf} x^m exp(-(x^2 + a^2)/2) I_{m-1} (ax) dx
Where I_(m-1) (x)
is modified bessel function.
The calculation has been done using the infinite Bessel series. The infinte series has truncated when the relative error is been less than 10-9.
This function has been developed for Communication toolbox in Scilab under Project FOSSEE Toolbox.
- Change current directory to
path/to/function/
. - In Scilab prompt, run:
exec('marcumq.sci')
. This will load the function in environment.
The function is tested on Scilab 5.5.2. There is no specific OS requirement.
q = marcumq(a, b, m)
-
Input Arguments:
a_vec
: Scalar or Vector or Matrix of values ofa
b_vec
: Scalar or Vector or Matrix of values ofb
m_vec
: Scalar or Vector or Matrix of values ofm
-
Conditions:
size(a_vec) == size(b_vec) == size(m_vec)
: The returned vector will be ofsize(m_vec)
whereq_vec(i) = marcumq(a_vec(i), b_vec(i), m_vec(i))
- If size of inputs
a_vec
,m_vec
orb_vec
is equal to [1 1] then it will be converted to size of other inputs that is not[1 1]
. - If more than one input has size not equal to
[1 1]
and size of vectors are not same then error will be thrown.
-
Output:
q
: Vector of size of inputs with values calculated by taking each individual elements
from the inputs. i.e.q(i) = marcumq(a(i), b(i), m(i))
y = marcumq(1,2);
disp(y)
y = marcumq(1,2,2);
disp(y)
Output:
0.2690121
0.5544845
This file must be used under the terms of the CeCILL.
This source file is licensed as described in the file COPYING, which
you should have received as part of this distribution. The terms
are also available at
http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt