gp_neurobio/code/code_cw.py
2018-11-08 16:27:16 +01:00

34 lines
797 B
Python

import numpy as np
import matplotlib.pyplot as plt
freq = 800
freq2 = 820
dt = 0.00001
x = np.arange(0.0, 1.0, dt)
eod = np.sin(x * 2 * np.pi * freq) + np.sin(x * 2 * np.pi * freq * 2) * 0.5
eod2 = np.sin(x * 2 * np.pi * freq2) + np.sin(x * 2 * np.pi * freq2 * 2) * 0.5
fig = plt.figure(figsize=(5., 7.5))
ax= fig.add_subplot(311)
ax.plot(x, eod, color="darkgreen", linewidth = 1.0)
ax.set_xlim(0.0, 0.1)
ax.set_ylabel("voltage [mV]")
ax= fig.add_subplot(312)
ax.plot(x, eod2, color="crimson", linewidth = 1.0)
ax.set_xlim(0.0, 0.1)
ax.set_ylabel("voltage [mV]")
ax= fig.add_subplot(313)
ax.plot(x, eod + eod2 * 0.05, color="lightblue", linewidth = 1.0)
ax.set_xlim(0.0, 0.1)
ax.set_xlabel("time [s]")
ax.set_ylabel("voltage [mV]")
plt.tight_layout()
plt.savefig("eods.pdf")
plt.show()