import matplotlib.pyplot as plt
import numpy as np
import random
from scipy.fftpack import fft, fftshift

Nsamples = 2**16
Fsig1 = 5 #Hz
Fsig2 = 10 #Hz
Fsample = 25 #Hz
werte=[]
for i in range(0, Nsamples):
	rnd = random.randint(0, 1000)
	sig1 = np.sin(2 * np.pi * Fsig1 * i / Fsample)*2**15+2**15
	sig2 = np.sin(2 * np.pi * Fsig2 * i / Fsample)*2**15+2**15

	werte.append(sig1 + sig2/1000 + rnd*0.01)
#FFT
Y = np.hanning(len(werte))*werte
Y = np.fft.fft(Y)
N = int(len(werte)/2)
X = np.linspace(0, Fsample/2, N, endpoint=True)
Y = 2.0*np.abs(Y[:N])/N
Y = Y/2**15
Y = 20*np.log10(Y)
plt.plot(X,Y)
plt.xlabel("f [Hz]")
plt.ylabel("Amplitude [dBFS]")
plt.show()