Hi there.
I'm working with realizations of random correlated data using a given
power spectra (no correlation matrix is given).
What I do to perform such realizations is that I generate a vector of
normally distributed data, calculate the fft of this
vector and multiply that by the square root of the given power spectra.
Then I make the ifft of this product, which
I expect to represent the realization of my random variable. My problem
is that the correlation of my data
looks O.K. but the amplitude gets smaller as I increase the # of points
in my original vector.
Any hints on what's going on?
This is a demo file of what I'm doing:
N = 201;
rmax = 2000;
dr = rmax/(N-1);
kmax = 2*pi/dr;
k = linspace(0,kmax,N);
r = [0:dr:rmax];
l = 17; rms_h = 5;
R = fft( randn( size( r ) ) );
ksq = k.^2;
lsq = l*l;
variance = rms_h*rms_h;
P = variance*l/( 2*sqrt( pi ) )*exp( -ksq*lsq/4 );
H = sqrt( P ).*R; realiz = real( ifft(H) );
figure(1)
plot(r,realiz), box on, grid on, title('\lambda_0 = 17
m'),ylabel('h(m)'),axis([0 rmax -20 20]);
Generating correlated data with a given power spectrum.
Started by ●April 1, 2008