import numpy as np import matplotlib.pyplot as plt #dtype:データ型 #int:整数 def step(x): return np.array(x>0, dtype=np.int) x = np.arange(-10,10,0.1) y = step(x) plt.plot(x, y) plt.xlabel("Step")
import numpy as np import matplotlib.pyplot as plt #dtype:データ型 #int:整数 def step(x): return np.array(x>0, dtype=np.int) x = np.arange(-10,10,0.1) y = step(x) plt.plot(x, y) plt.xlabel("Step")