Python how to plot graph sine wave

前端 未结 9 1339
死守一世寂寞
死守一世寂寞 2021-02-01 07:11

I have this signal :

from math import*
Fs=8000
f=500
sample=16
a=[0]*sample
for n in range(sample):
    a[n]=sin(2*pi*f*n/Fs)

How can I plot a

9条回答
  •  無奈伤痛
    2021-02-01 07:45

    import matplotlib.pyplot as plt
    import numpy as np
    #%matplotlib inline
    x=list(range(10))
    def fun(k):
         return np.sin(k)
    y=list(map(fun,x))
    plt.plot(x,y,'-.')
    #print(x)
    #print(y)
    plt.show()
    

提交回复
热议问题