from math import pi
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

a = 1.
T = 5*360
n_steps = 360
t = np.linspace(0. ,T , n_steps)/T*2*pi
om1 = 20.
om2 = 22.

x1 = a * np.cos(om1 * t)
x2 = a * np.cos(om2 * t)

x3 = x1 + x2

fig, (ax1, ax2, ax3) = plt.subplots(3, sharex = True)

ax1.plot(t, x1, lw=2, c='k', label=r'$x_1(t)$')
ax1.set_ylabel(r'$x_1(t)$',fontsize=14)
ax2.plot(t, x2, lw=2, c='k', label=r'$x_2(t)$')
ax2.set_ylabel(r'$x_2(t)$',fontsize=14)
ax3.plot(t, x3, lw=2, c='k', label=r'$x_1(t) + x_2(t)$')
ax3.set_ylabel(r'$x_3(t)$',fontsize=14)
plt.subplots_adjust(hspace=0)
#plt.tight_layout()
plt.legend()
plt.savefig('schwebung.eps')
plt.show()
