English: Graph showing how envelope (in red) and phase (black dots, for zero crossings) of a signal can be simply derived with the Hilbert Transform.
The corresponding python code is:
importnumpyasnpimportscipy.signalimportmatplotlib.pyplotasmpimportmatplotlib.mlabasmm# Create a function for the instantaneous frequency ...dt=0.01t=np.arange(0,20,dt)f=(0.2+1.3*np.exp(-((t-10)/4)**2))# ... and envelopeenv=2-f/2# Plot the corresponding function valuesdf=2*np.pi*f*dtfsum=np.cumsum(df)x=np.sin(fsum)*env# Using the Hilbert transform, find the envelope and zero crossingsenvelope=abs(scipy.signal.hilbert(x))phase=np.angle(scipy.signal.hilbert(x))zeroCrossing=mm.find(np.diff(np.sign(np.cos(phase)))==2)# Plot the resultsmp.plot(x)mp.hold('on')mp.plot(envelope,'r')mp.plot((0,2000),(0,0),'k--')mp.plot(zeroCrossing,np.zeros(zeroCrossing.size),'ko')mp.ylim((-2,2.2))mp.savefig('hilbert.eps')mp.show()
ייחוס – יש לתת ייחוס הולם, לתת קישור לרישיון, ולציין אם נעשו שינויים. אפשר לעשות את זה בכל צורה סבירה, אבל לא בשום צורה שמשתמע ממנה שמעניק הרישיון תומך בך או בשימוש שלך.
שיתוף זהה – אם תיצרו רמיקס, תשנו, או תבנו על החומר, חובה עליכם להפיץ את התרומות שלך לפי תנאי רישיון זהה או תואם למקור.