Skip to content

Instantly share code, notes, and snippets.

@denismaster
Created February 19, 2018 05:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save denismaster/aa01731a0395317379a1c833dc408aca to your computer and use it in GitHub Desktop.
Save denismaster/aa01731a0395317379a1c833dc408aca to your computer and use it in GitHub Desktop.
import numpy
import matplotlib.pyplot as plt
print("Введите X_min")
xmin=int(input())
print("Введите X_max")
xmax=int(input())
xcoords = numpy.arange(xmin, xmax+1, 0.1)
toSin = lambda x: numpy.sin(x)
mapFunc = numpy.vectorize(toSin)
sinus = mapFunc(xcoords)
plt.title("График синусоиды")
plt.plot(sinus, color='red', linewidth=2);
plt.show()
mean = 0
std = 1
samples = numpy.random.normal(mean, std, size=sinus.shape[0])
plt.title("Белый шум")
plt.plot(samples)
plt.show()
sum = numpy.add(sinus, samples)
plt.title("Смесь синусоиды и белого шума")
plt.plot(sum)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment