输出 Mathematica Karhunen Loeve Expansion 的问题

Problem with Mathematica's KarhunenLoeveExpansion's output

我有一个名为 realizationMat 的矩阵,它包含一个随机过程的 90 个实现的 101 个测量值。我会 post 而不是一个删节的 11*5 小例子

meshgrid[x_List, y_List] := {ConstantArray[x, Length[x]], 
Transpose@ConstantArray[y, Length[y]]}     
{xx, yy} = meshgrid[Range[0, 1, .1], Range[0, 1, .1]];
kernel = Exp[(-1)*Abs[xx - yy]]; 
{eval, evec} = Eigensystem[kernel];
realizationNumber = 5;
longitudeOfEigA = Length[evec];
realizationNumber = 5;
evecRand = 0*ConstantArray[1, {longitudeOfEigA}];
realizationMat = 0*ConstantArray[1, {realizationNumber}];
For[i = 0, i < realizationNumber + 1, i++,
For[j = 0, j < longitudeOfEigA, j++;
evecRand[[j]] = 
eval[[j]]^0.5*RandomVariate[NormalDistribution[]]*
evec[[j]]; (*Print[i];*)realization = Total[evecRand, {1}]; 
realizationMat[[i]] = realization]];
VA1 = realizationMat[[1]];
VA2 = realizationMat[[2]];
VA3 = realizationMat[[3]];
VA4 = realizationMat[[4]];
VA5 = realizationMat[[5]];
KLVariablesB = KarhunenLoeveDecomposition[{VA1, VA2, VA3, VA4, VA5}];

文档中写道:变换矩阵 m 的行是由数组 ai 形成的协方差矩阵的特征向量。 此外,变换后的数组bi 是不相关的,按方差递减的顺序给出,并且与 ai 具有相同的总方差。

但是,如果我写ListPlot[{KLVariablesB[[2, 1]]}, Joined -> True],它看起来根本不像一个特征向量,见图1

. Also, if I instead plot ListPlot[{KLVariablesB[[1, 1]]}, Joined -> True], it looks way more as an eigenvector, see figure 2,但这些不是原始协方差矩阵的特征向量。

有人可以告诉我我的代码有什么问题吗?

此致。

我还附上了内核的原始特征向量的图像

运行 给定的代码

meshgrid[x_List, y_List] := {ConstantArray[x, Length[x]], 
Transpose@ConstantArray[y, Length[y]]}     
{xx, yy} = meshgrid[Range[0, 1, .1], Range[0, 1, .1]];
kernel = Exp[(-1)*Abs[xx - yy]]; 
{eval, evec} = Eigensystem[kernel];
realizationNumber = 5;
longitudeOfEigA = Length[evec];
realizationNumber = 5;
evecRand = 0*ConstantArray[1, {longitudeOfEigA}];
realizationMat = 0*ConstantArray[1, {realizationNumber}];
For[i = 0, i < realizationNumber + 1, i++,
For[j = 0, j < longitudeOfEigA, j++;
evecRand[[j]] = 
eval[[j]]^0.5*RandomVariate[NormalDistribution[]]*
evec[[j]]; (*Print[i];*)realization = Total[evecRand, {1}]; 
realizationMat[[i]] = realization]];
VA1 = realizationMat[[1]];
VA2 = realizationMat[[2]];
VA3 = realizationMat[[3]];
VA4 = realizationMat[[4]];
VA5 = realizationMat[[5]];
KLVariablesB = KarhunenLoeveDecomposition[{VA1, VA2, VA3, VA4, VA5}];

lp = ListLinePlot[{KLVariablesB[[2, 1]]}, PlotMarkers -> Automatic];

Manipulate[Show[Plot[a Sin[b + c x], {x, 0, 3 Pi}], lp,
  PlotRange -> {{0, 5}, {-6, 6}}],
 {{a, 6}, 0.5, 8}, {{b, 0.21}, 0, 4}, {{c, 3.1}, 1, 10}]

您的分辨率似乎不够。一个正弦波可以匹配到输出。

请注意,这里有一个专门用于 Mathematica 的 Stack Exchange 站点:https://mathematica.stackexchange.com/