I am triying to generate realizations of a Gaussian random process using the KL expansion. For that, I need to multiply an eigenvector for an eigenvalue and a random variable.
I have tried
realizationNumber = 500;
evecRand = 0*ConstantArray[1, {longitudeOfEigA, longitudeOfEigA}];
For[i = 1, i <= 2, i++,
For[j = 1, j <= 4, j++;
evecRand[[j]] =
eval[[j]]^0.5*RandomVariate[NormalDistribution[]]*evec[[j]]]];
My result is
evecRand[[7]]
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0}
However, if I write
eval[[j]]^0.5*RandomVariate[NormalDistribution[]]*evec[[j]]
I get
{0.0950823, 0.0945212, 0.0924617, 0.0889367, 0.0840018, 0.0777355, \
0.0702368, 0.0616249, 0.0520361, 0.0416224, 0.030549, 0.0189913, \
0.00713256, -0.00483922, -0.0167343, -0.0283641, -0.0395443, \
-0.0500977, -0.0598569, -0.0686673, -0.0763893, -0.0829003, \
-0.0880973, -0.0918978, -0.0942416, -0.0950915, -0.0944341, \
-0.0922798, -0.0886626, -0.0836401, -0.0772917, -0.0697182, \
-0.0610395, -0.0513933, -0.0409323, -0.0298226, -0.0182401, \
-0.00636851, 0.00560405, 0.0174878, 0.0290943, 0.0402396, 0.0507471, \
0.0604502, 0.069195, 0.076843, 0.0832729, 0.0883828, 0.0920918, \
0.0943409, 0.0950946, 0.0943409, 0.0920918, 0.0883828, 0.0832729, \
0.076843, 0.069195, 0.0604502, 0.0507471, 0.0402396, 0.0290943, \
0.0174878, 0.00560405, -0.00636851, -0.0182401, -0.0298226, \
-0.0409323, -0.0513933, -0.0610395, -0.0697182, -0.0772917, \
-0.0836401, -0.0886626, -0.0922798, -0.0944341, -0.0950915, \
-0.0942416, -0.0918978, -0.0880973, -0.0829003, -0.0763893, \
-0.0686673, -0.0598569, -0.0500977, -0.0395443, -0.0283641, \
-0.0167343, -0.00483922, 0.00713256, 0.0189913, 0.030549, 0.0416224, \
0.0520361, 0.0616249, 0.0702368, 0.0777355, 0.0840018, 0.0889367, \
0.0924617, 0.0945212, 0.0950823}
Which is what I am looking for. How can I save these vectors to evecRand?
eval
,evec
,longitudeOfEigA
, andlongitudeOfEigA
? $\endgroup$eval
andevec
are obtained from usingEigensystem
.eval
is a list of lenght 101,evec
is a matrix of size 101*101,longitudeOfEigA
is a constant with a value of 101 $\endgroup$