我正在尝试合并以下代码的数组:
import numpy as np
from numpy import column_stack as column_stack
from matplotlib.pyplot import plot as plot
from matplotlib.pyplot import show as show
N = 120
Yq = np.arange(0,N-1)
YY = Yq[N//2:]-N + Yq + Yq[:N//2]+N
#YY = column_stack( (Yq[N//2:]-2*PI, Yq, Yq[:N//2]+2*PI))
plot(YY)
show()
我尝试了'+'
和column_stack()
,但是都没有用。如何合并三个数组?谢谢。
答案 0 :(得分:1)
您要使用的是numpy.concatenate()
,而不是numpy.column_stack()
:
YY = numpy.concatenate( (Yq[N//2:]-2*PI, Yq, Yq[:N//2]+2*PI))