Skip to content

Instantly share code, notes, and snippets.

@cobanov
Created November 15, 2020 23:13
Show Gist options
  • Save cobanov/c16932ea1c5562f02cc27d7908cf85b9 to your computer and use it in GitHub Desktop.
Save cobanov/c16932ea1c5562f02cc27d7908cf85b9 to your computer and use it in GitHub Desktop.
import numpy as np
import matplotlib.pyplot as plt
def create_signal(f):
w = 2 * np.pi * f
t = np.linspace(0, 0.1, 1000)
value = np.sin(w * t)
return t, value
t1, v1 = create_signal(10)
t2, v2 = create_signal(20)
v3 = list(map(lambda x, y: x if x > y else y, v1, v2))
plt.plot(t1, v1, linestyle="dashed")
plt.plot(t2, v2, linestyle="dashed")
plt.plot(t2, v3)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment