How to generate a Gaussian random complex vector of N elements
조회 수: 166(최근 30일)
Chunru 2021년 5월 29일
% Assume that real and imaginary parts are independent
% 1/sqrt(2) makes the variaonce to be 1
x = 1/sqrt(2)*(rand(N, 1) +1i*rand(N,1));
Walter Roberson 2021년 5월 29일
편집: Walter Roberson 2021년 5월 29일
There are two approaches to ensuring a sample mean of exactly 0, and a sample variance of exactly 1.
format long g
N = 5; % number of snapshots
x = 1/2*(randn(N, 1) +1i*randn(N,1))
xMean = mean(x)
xVariance = var(x)
First approach: modify the values as a group
x2 = x - xMean;
xMean2 = mean(x2) %verify it is exactly 0, to within round-off error
x2 = x2 ./ sqrt(xVariance);
xVariance = var(x2)
The number of degrees of freedom of the original x is 10 -- N*2 independent random values.
The number of degrees of freedom of the modified group, x2, is only 8: although each of the values is still random, together as a group they are correlated in ways that reduces the freedom.
Second approach: take only initial entries and generate the remaining values as whatever is necessary to make the group fit. This is proving to be more difficult than I thought it would be.