Home > matutils > interf > randn_ft_of_real.m

randn_ft_of_real

PURPOSE ^

rnd=randn_ft_of_real(N)

SYNOPSIS ^

function rnd=randn_ft_of_real(N)

DESCRIPTION ^

 rnd=randn_ft_of_real(N)

 Make an array of normally distributed unit variance numbers
 which have a purely real Fourier transform

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function rnd=randn_ft_of_real(N)
0002 % rnd=randn_ft_of_real(N)
0003 %
0004 % Make an array of normally distributed unit variance numbers
0005 % which have a purely real Fourier transform
0006 
0007 % Generate arrays of complex random numbers with
0008 % unit power spectrum ie. whose mean(abs^2)=1
0009 m=N-1; n=N/2-1;
0010 a=complex(randn(m,n),randn(m,n))/sqrt(2); % main block
0011 b=complex(randn(n,1),randn(n,1))/sqrt(2); % half col
0012 c=complex(randn(n,1),randn(n,1))/sqrt(2); % half col
0013 d=complex(randn(1,n),randn(1,n))/sqrt(2); % half row
0014 
0015 % Fill N*N array appropriately
0016 % Paper and pencil required to figure out this is right...
0017 rnd=zeros(N);
0018 rnd(2:N,2:N/2)=a;
0019 rnd(2:N,N/2+2:N)=rot90(conj(a),2);
0020 
0021 rnd(2:N/2,1)=b;
0022 rnd(N/2+2:N,1)=flipud(conj(b));
0023 
0024 rnd(2:N/2,N/2+1)=c;
0025 rnd(N/2+2:N,N/2+1)=flipud(conj(c));
0026 
0027 rnd(1,2:N/2)=d;
0028 rnd(1,N/2+2:N)=fliplr(conj(d));
0029 
0030 rnd(1,1)=randn; rnd(N/2+1,1)=randn;
0031 rnd(1,N/2+1)=randn; rnd(N/2+1,N/2+1)=randn;
0032 return

Generated on Sun 14-Jun-2015 17:12:45 by m2html © 2005