Skip to content

Module for making nice plots of complex DFT vectors

Notifications You must be signed in to change notification settings

BlankAdventure/zstem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 

Repository files navigation

zstem -> Complex Stem Plots

Module for making nice plots of complex DFT vectors

Basic usage:

    from numpy.fft import fft, fftshift
    
    N = 20 #Total number of bins
    k1 = 2.0 #First component
    k2 = 6.0 #Second component
    
    x = np.arange(N)
    s = np.cos(x*2*k1*np.pi/N) + np.sin(x*2*k2*np.pi/N)
    KS = fftshift(fft(s))

    stem2D(KS,fs=150,label_active=True,mode='RI',fancy=True)

...which produces the following figure:

The cosine components show up in bins +/- 2 and fall in the real (vertical) plane. The sine components show up in bins +/- 6, and fall on the imaginary (flat) plane; i.e., looking in/out of the page. The spectrum is hermetian-symmetric, as expected for a purely real input signal.

About

Module for making nice plots of complex DFT vectors

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages