fork download
  1. import scipy
  2. import scipy.fftpack
  3. import cmath
  4. import math
  5. import matplotlib.pyplot as plt
  6. import numpy as np
  7. from scipy import signal
  8. from scipy.signal import freqs, iirfilter
  9. x = np.linspace(0, 1024, 1024) # диапазон значений x
  10. byts = ([0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1])
  11. ff = 64 # %Частота несущей
  12. ns = np.sin(2 * np.pi * (x - 1) * ff / 1024) # несущая
  13. y = ns * byts[np.round((x + 31) / 64)] # %сигнал
  14. plt.plot(y)
Runtime error #stdin #stdout #stderr 0.55s 419264KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 13, in <module>
TypeError: only integer scalar arrays can be converted to a scalar index