The usage of ncx2cdf.m
- From: "Ingrid Svensson" <ingrid_svensson81@xxxxxxxx>
- Date: Tue, 13 Dec 2005 08:03:02 -0500
There seems to be a contrast in the results reported with the
function ncx2cdf.m
This function basically estimates the probability that the sum of the
squares of Gaussian random variables with non-zero means and the same
variance sigma^2 is less than some value. The following lines of code
compare the Monte-Carlo simulation with the theoretical value,
M = randn(4,1)
% Generating the X sequence
X = diag(M)*ones(4,1000000) + sqrt(1) *
complex(randn(4,1000000),randn(4,1000000));
X1 = [real(X);imag(X)];clear X
X2 = abs(X1).^2;
% Computing the sum of the squares
X3 = sum(X2,1);
XL = length(find(X3<C))/length(X3)
% Theoretical value
M = mean(X1,2);M=frob(M);
XT2 = ncx2cdf(C,8,M)
Note that I am generating a non-zero mean Gaussian random vector with
mean M (which is the sum of the squares of the mean). The results are
very good in terms of XL(Monte-Carlo simulation estimate) and
XT2(Theoretical estimate)
Now, I am encountering a problem of normalization. Note the entity X
is composed of real and complex parts which have variance 1, but when
I put some non-zero variance i.e.
M = randn(4,1)
% Generating the X sequence
X = diag(M)*ones(4,1000000) + sqrt(.5) *
complex(randn(4,1000000),randn(4,1000000)); % sqrt(.5) is just an
example, it could be anything in general
X1 = [real(X);imag(X)];clear X
X2 = abs(X1).^2;
% Computing the sum of the squares
X3 = sum(X2,1);
XL = length(find(X3<C))/length(X3)
% Theoretical value
M = mean(X1,2);M=frob(M);
?????????????????????
What should be my input to the part of the program designated by
question marks, so that I may procure a theoretical estimate of XL,
for any arbitrary sigma^2
The answer which gives me somewhat correct answers is
ncx2cdf(C/sqrt(.5),8,M), but the estimate is not as good as in the
central chi-square case. Is it my fault that I am making some error
with respect to normalization, or is there some accuracy error with
the function! Could you kindly clarify the issues!
.
- Follow-Ups:
- Re: The usage of ncx2cdf.m
- From: Peter Perkins
- Re: The usage of ncx2cdf.m
- Prev by Date: Re: turn decimal numbers to file name
- Next by Date: converting C code in matlab simulink
- Previous by thread: Simple plotting with two axes (plotyy) and legends
- Next by thread: Re: The usage of ncx2cdf.m
- Index(es):
Relevant Pages
|