"Kashif " <rajakashif@gmail.com> wrote in message <hvta2a$7g8$1@fred.mathworks.com>...
> Hi All,
>
> How shall I Generate Rayleigh Channel (h) with a variance other than 1 using randn.
> Kinldy also tell how can I verify it.
>
> The problem I am facing is
>
> N=10000;
>
> ********************************************************
> h=rand(N,1)+j*randn (N,1)/sqrt(2)
> % gives var(h)=~0.5 and mean (real(h))=~0.5)
> ********************************************************
> h= sqrt(0.5)*rand(N,1) + j*sqrt(0.5)*randn (N,1)
> % gives var(h)=~0.5 and mean (real(h))=~0.35)
> ********************************************************
> h=rand(N,1)+j*randn (N,1)
> % gives var(h)=~1 and mean (real(h))=~0.5)
> ********************************************************
> if Z=X+Y, then
> As per var(Z)=var(X)+var(Y). Why this formula is not working for above.
>
> Secondly why mean is not zero.
      
Try
r = sigma*(randn(N,1);
h = r.*exp(j*2*pi*rand(N,1));
where sigma is the square root of the desired variance.
Roger Stafford
