Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib.pyplot as plt
- from itertools import starmap
- from functools import reduce
- def signal(x, amp=1.0, omega=1.0, phi=0):
- return amp * np.sin(x * omega - phi)
- def sum_signal(param_set):
- return reduce(lambda a, x: a + x, starmap(signal, param_set))
- x = np.linspace(-2 * np.pi, 10.0 * np.pi, 400)
- xx = sum_signal(
- [(x, 2.0, phi_i, 0) for phi_i in [12.0, 11.5, 8.5]]
- )
- sigma = 0.3 * max(xx)
- result_sig = xx + np.random.normal(0, sigma, len(xx))
- plt.plot(result_sig, label='Шум')
- plt.plot(xx, label='Исходный')
- plt.legend()
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement