This is a file from the Wikimedia Commons

File:HilbertTransform EnvelopePhase.png

From Wikibooks, open books for an open world
Jump to navigation Jump to search

HilbertTransform_EnvelopePhase.png(800 × 600 pixels, file size: 48 KB, MIME type: image/png)

Summary

Description
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:

import numpy as np
import scipy.signal
import matplotlib.pyplot as mp
import matplotlib.mlab as mm

# Create a function for the instantaneous frequency ...
dt = 0.01
t = np.arange(0,20,dt)
f = (0.2 + 1.3*np.exp(-((t-10)/4)**2))

# ... and envelope
env = 2-f/2

#  Plot the corresponding function values
df = 2*np.pi*f*dt
fsum = np.cumsum(df)
x = np.sin(fsum)*env

#  Using the Hilbert transform, find the envelope and zero crossings
envelope = 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 results
mp.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()
Date
Source Own work
Author Thomas.haslwanter

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

11 March 2012

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current11:42, 11 March 2012Thumbnail for version as of 11:42, 11 March 2012800 × 600 (48 KB)Thomas.haslwanter

Global file usage

The following other wikis use this file:

Metadata