From Wikibooks, open books for an open world
Original file (812 × 612 pixels, file size: 38 KB, MIME type: image/png )
Summary
Generated with the following code:
import numpy as np
import matplotlib.pyplot as plt
frames_per_cycle = 256
freq = 3
nr_frames = frames_per_cycle * freq
phase = 0
audio = np.fromfunction(lambda y : (y / frames_per_cycle + phase) % 1 - 0.5, (nr_frames,))
maxfreq = 16
freq_plotstyle = "o"
ft = np.fft.rfft(audio[:frames_per_cycle]) / (frames_per_cycle / 2)
if maxfreq != None :
ft = ft[:maxfreq]
#end if
abs_mag = True
fig, ax = plt.subplots(nrows = 2 + int(not abs_mag))
ax[0].plot(np.linspace(0, freq, nr_frames), audio, "-")
ax[0].set_title("Time Domain")
if abs_mag :
ax[1].plot(np.linspace(0, len(ft), len(ft)), np.abs(ft), freq_plotstyle)
ax[1].set_title("Frequency Domain")
else :
ax[1].plot(np.linspace(0, len(ft), len(ft)), np.real(ft), freq_plotstyle)
ax[1].set_title("Frequency Domain (Real)")
ax[2].plot(np.linspace(0, len(ft), len(ft)), np.imag(ft), freq_plotstyle)
ax[2].set_title("Frequency Domain (Imag)")
#end if
plt.subplots_adjust(hspace = 0.5)
plt.show()
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication .
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.
http://creativecommons.org/publicdomain/zero/1.0/deed.en CC0 Creative Commons Zero, Public Domain Dedication false false
English Add a one-line explanation of what this file represents
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time Thumbnail Dimensions User Comment
current 10:42, 19 July 2014 812 × 612 (38 KB) Ldo User created page with UploadWizard
File usage
The following page uses this file:
This file contains additional information, probably added from the digital camera or scanner used to create or digitize it.
If the file has been modified from its original state, some details may not fully reflect the modified file.