![](/img/trans.png)
[英]How should I change the different size `n=100,200,300,400` so that the `h1t` function of these values `n` are in the same plot?
[英]How can I put all graphs for different sample size `n=10, 100, 1000, 2000` in the same plot and change the color of `y=1` in red?
對於樣本量n=1000
,我 plot 下面的圖表基於代碼
n = 1000;
m = RandomVariate[GaussianOrthogonalMatrixDistribution[Sqrt[2]/Sqrt[n], n]];
{eval, evec} = Eigensystem[m];
h = evec[[All, 1]];
imin = Ordering[eval, 1][[1]];
lambda2minlambda1 = Sort[eval][[2]] - Sort[eval][[1]];
tn = 1/(4*lambda2minlambda1);
Plot function H1(噸)
Plot[Abs[h[[imin]]]*Exp[-2*eval[[imin]]*t]/Sqrt[Sum[h[[i]]^2*Exp[-4*eval[[i]]*t], {i, 1, n}]],
{t, 0, 10*tn},
GridLines -> {{tn}, {1}},
GridLinesStyle -> Directive[{Red, Blue}, Thickness[0.008]],
PlotRange -> Full]
問題:
如何將不同樣本大小n=10, 100, 1000, 2000
10、100、1000、2000 的所有圖表放在同一個 plot 中並將y=1
的顏色更改為紅色?**
嘗試
Show[Append[Table[
m=RandomVariate[GaussianOrthogonalMatrixDistribution[Sqrt[2]/Sqrt[n], n]];
{eval,evec}=Eigensystem[m];h=evec[[All,1]];imin=Ordering[eval,1][[1]];
lambda2minlambda1=Sort[eval][[2]]-Sort[eval][[1]];tn=1/(4*lambda2minlambda1);
Plot[Abs[h[[imin]]]*Exp[-2*eval[[imin]]*t]/Sqrt[Sum[h[[i]]^2*Exp[-4*eval[[i]]*t],
{i,1,n}]],{t,0,10*tn},PlotRange->{{0,60},{0,1}}],
{n,{10,100,1000,2000}}],
Plot[1,{x,0,60},ColorFunction->Function[{x,y},Red]]],
PlotRange->{{0,60},{0,1}}]
在 Mathematica 中做任何事情總是至少有十幾種不同的方法。 選擇一個您可以記住並使用而不會出錯的。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.