我有一些二维数据文件,我想用 gnuplot 绘图。不幸的是,文件的值不在同一范围内。但是,我需要 z 轴相同。这是我的代码:
set pm3d map interpolate 1,1
splot "Diff.txt" matrix using (1+$1):(1+$2):3
unset key
set terminal png font arial 20 size 1200, 1200
set palette defined ( 0 "blue", 8 "white", 16 "red")
set zrange [-0.04:0.04]
set output "Diff.png"
replot
Run Code Online (Sandbox Code Playgroud)
我从 -0.015 - 0.02 得到一个 z 轴。有没有办法“强制”gnuplot 使用给定的范围?
我从理论功率谱密度中生成一些时间序列.
基本上,我在时空中的函数由X(t) = SUM_n sqrt(a_n) + cos(w_n t + phi_n)下式给出,其中at是给定a_n值并且是一些随机相位.为了得到一个真实的时间序列,我必须总结模式,我的当然也是大小.PSDw_nphi2^25t2^25
如果我用python做到这一点,这将花费几周时间......
有什么方法可以加快速度吗?像一些矢量计算?
t_full = np.linspace(0,1e-2,2**12, endpoint = False)
signal = np.zeros_like(t_full)
for i in range(w.shape[0]):
signal += dataCOS[i] * np.cos(2*np.pi* t_full * w[i] + random.uniform(0,2*np.pi))
Run Code Online (Sandbox Code Playgroud)
其中dataCOS是sqrt a_n,w = w,random.uniform表示随机相移phi
就像标题所说的那样,我正在寻找一些生成日志空间值的函数,就像numpy.logspace一样,但是要使用python。有想法吗?