Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有两列数据,x 和 y。y 数据采用下面的三角波形状。如您所见,三角形有 2 个正梯度部分和 1 个负梯度部分。
我想写一个程序:
这在 Python 中是如何做到最好的?
filen = 'filename.txt' x = loadtxt(fn,unpack=True,usecols=[0]) y = loadtxt(fn,unpack=True,usecols=[1]) n = ma.masked_where(gradient(y) < 0, y) p = ma.masked_where(gradient(y) > 0, y) pylab.plot(x,n,'r',x,p,'g')
对我有用!