Define a Periodic DT Signal and Compute the Fourier Series Coefficients
I am going to choose a sine signal, since there have been many cosines done already.
DT signal: $ x[n] = 2\sin(\pi n + \frac{\pi}{2}) + 4\sin(\frac{\pi}{2} n + \pi)\, $
Now, each sine has its own period, and the fundamental period of the function is the greater of the separate periods.
$ N_2sin = \frac{2\pi}{\pi} k = \frac{2}{1} k $
$ N_4sin = \frac{2\pi}{\frac{\pi}{2}} k = \frac{2}{\frac{1}{2}} k $
Take $ k = 1\, $,
$ N_2sin = 2\, $
$ N_4sin = 4\, $, so the overall fundamental period is
$ N = 4\, $
In order to find the coefficients, we must first calculate the values of $ x[n]\, $ for four consecutive integer values of $ n\, $. By plugging values of $ n\, $ into the given signal, we find that
$ x[0] = 2\, $
$ x[1] = -6\, $
$ x[2] = 2\, $
$ x[3] = 2\, $
$ x[4] = 2\, $
$ x[5] = -6\, $
$ x[6] = 2\, $
$ x[7] = 2\, $, which continue to repeat in this way every 4 integers.
$ a_k = \frac{1}{4}\sum^{3}_{n = 0} x[n] e^{-jk\frac{\pi}{2} n}\, $
$ a_0 = \frac{1}{4}\sum^{3}_{n = 0} x[n] e^0\, $
$ = \frac{1}{4}\sum^{3}_{n = 0} x[n]\, $
$ = \frac{1}{4}(2 - 6 + 2 + 2)\, $
$ a_0 = 0\, $
$ a_1 = \frac{1}{4}\sum^{3}_{n = 0} x[n] e^{-j\frac{\pi}{2} n}\, $
$ = \frac{1}{2}(x[0] + x[1]e^{-j\frac{\pi}{2}})\, $
$ = \frac{1}{2}(2 - 12(-1))\, $
$ = \frac{1}{2}(14)\, $
$ = 7\, $