Hướng dẫn plot fft in python - vẽ fft trong python

Mục tiêu là hiển thị một thác nước đẹp từ FFT hiện có

Bắt đầu từ một FFT hiện có có thể được tìm thấy tại https://docs.scipy.org/doc/scipy/reference/tutorial/fftpack.html

import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
from scipy.fftpack import fft
from mpl_toolkits.mplot3d import Axes3D
N = 600
T = 1.0 / 800.0
x = np.linspace(0.0, N*T, N)
y = np.sin(50.0 * 2.0*np.pi*x) + 0.5*np.sin(80.0 * 2.0*np.pi*x)
yf = fft(y)
xf = np.linspace(0.0, 1.0/(2.0*T), N//2)
import matplotlib.pyplot as plt
plt.plot(xf, 2.0/N * np.abs(yf[0:N//2]))
plt.grid()
plt.show()

Kết quả là phổ dự kiến. Bây giờ chúng tôi muốn vẽ một thác nước như được mô tả tại https://matplotlib.org/mpl_toolkits/mplot3d/tutorial.html#wireframe-plots Chúng tôi muốn một cái gì đó như thế:

x, y = (xf, np.arange(N))
X,Y=np.meshgrid(x,y)
Z = yf
Axes3D.plot_wireframe(X, Y, Z,rstride=1,cstride=len(xf), lw=.5, alpha=0.5)
plt.show()

Trong đó x là phạm vi FREQ của FFT, y trục số lô và z mảng 2D với dữ liệu FFT. Nhưng chúng tôi gặp lỗi này:

TypeError: plot_wireframe() missing 1 required positional argument: 'Z'

Vấn đề là gì? Cảm ơn đã giúp đỡ.

Hướng dẫn plot fft in python - vẽ fft trong python

Hướng dẫn python plot array points - điểm mảng âm mưu python

Vấn đề là cú pháp của x = np.array([1,2,3,4,5,6,7,8,9,10]) y = np.array([1,2,3,4,5,6,7,8,9,10]) 1. Đó là sai những gì bạn muốn làm là x = np.array([1,2,3,4,5,6,7,8,9,10]) y = ...

Hướng dẫn pca plot python - pca âm mưu trăn

Lets take data following : import numpy as np from sklearn.datasets import load_breast_cancer import pandas as pd from sklearn.decomposition import PCA from sklearn import datasets from ...

Hướng dẫn dùng pyspark histogram python

Unfortunately I dont think that theres a clean plot() or hist() function in the PySpark Dataframes API, but Im hoping that things will eventually go in that direction.For the time being, you could ...

Hướng dẫn what is probability plot python? - python - âm mưu xác suất là gì?

scipy.stats.probplot (x, sparams = (), dist = Norm, fit = true, plot = none, rvalue = false)probplot(x, sparams=(), dist=norm, fit=True, plot=None, rvalue=False)[source]#Tính toán lượng tử ...

How do you plot specific columns in python?

In [1]: import pandas as pd In [2]: import matplotlib.pyplot as plt Air quality dataFor this tutorial, air quality data about (NO_2) is used, made available by OpenAQ and using the py-openaq ...

Hướng dẫn dùng matplotlib bar python

Hôm nay, chúng ta sẽ xem cách chúng ta có thể tạo Biểu đồ Python và Biểu đồ thanh Python bằng cách sử dụng thư viện Matplotlib và Seaborn Python . Hơn nữa, trong ...

Can you plot objects in python?

I want to plot Date Read with respect to Original Publication Year using Pandas in Python.Pandas Version = 0.16.2books_read.dtypes Title object My Rating ...