Created
March 8, 2023 15:42
-
-
Save gustheman/0d2f54ed1d6c777dab3f25f0e6cda075 to your computer and use it in GitHub Desktop.
Plotting frequencies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import tensorflow as tf | |
n = len(x) | |
T = 1/samples | |
yf = tf.signal.fft(ys) | |
xf = np.linspace(0.0, 1.0/(2.0*T), int(n/2)) | |
plt.plot(xf, 2.0/n*np.abs(yf[:n//2])) | |
plt.title('Spectrum') | |
plt.xlabel('Frequency Bin') | |
plt.ylabel('Amplitude') | |
plt.grid() | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment