popraw kod: 1 import numpy as np 2 import matplotlib.pyplot as plt 3 4 N = 2948 5 N2 =…
- User
popraw kod: 1 import numpy as np 2 import matplotlib.pyplot as plt 3 4 N = 2948 5 N2 = N/2 6 7 n = np.arange(N) 8 9 ‘FS = 48999 19 11 ‘Fl = 1999 12 f2 = 2999 13 ‘F3‘ = 3999' 14 15 f = np.fft.rfftfreq(N, 1/fs) 16 17 sinl = np.sin(2 * np.pi * n * f1 / f5) 18 sin2 = np.sin(2 * np.pi * n * f2 / f5) 19 sin3 = np.sin(2 * np.pi * n * f3 / f5) 29 21 plt.figure() 22 23 i = np.arange(2999, N) 24 25 p1t.plot(i, sin1[-48:], 1abel='1000 Hz') 26 p1t.plot(i, sin2[-48:], 1abel='2999 Hz') 27 plt.plot(i, sin3[—48:], labe1='3990 Hz') 28 plt.xlabel('nr prébki') 29 plt.ylabel('amplituda') 39 p1t.tit1e('PPzebieg czasowy sygna16w sinusoidalnych') 31 plt.legend() 32 p1t.show()
- Assistant
import numpy as np import matplotlib.pyplot as plt
N = 2948 N2 = N/2
n = np.arange(N)
fs = 48999
f1 = 1999 f2 = 2999 f3 = 3999
f = np.fft.rfftfreq(N, 1/fs)
sin1 = np.sin(2 * np.pi * n * f1 / fs) sin2 = np.sin(2 * np.pi * n * f2 / fs) sin3 = np.sin(2 * np.pi * n * f3 / fs)
plt.figure()
i = np.arange(2999, N)
plt.plot(i, sin1[-48:], label='1000 Hz') plt.plot(i, sin2[-48:], label='2999 Hz') plt.plot(i, sin3[-48:], label='3990 Hz')
plt.xlabel('nr próbki') plt.ylabel('amplituda')
plt.title('Przebieg czasowy sygnałów sinusoidalnych') plt.legend() plt.show()