$\cos(\pi n)$ fluctuates between $-1$ and $1$ depending on the values of $n$, and it would be the same as computing it with an exponential but the problem is that I just get part of the right answer...

  • 2
    $\begingroup$ can you share the real problem instead of asking if a simple equation $(-1)^n = \cos (\pi n)$ is correct ? $\endgroup$ – Ahmad Bazzi Jul 22 '19 at 11:51

$$(-1)^n = \cos(n\pi)=(e^{j\pi})^n=(e^{-j\pi})^n=e^{j\pi n} = e^{-j\pi n}$$

All of these would work. However, applying a DFT is bit tricky since it's directly at the Nyquist frequency and it technically violates the sampling theorem. You can certainly do the math but interpreting the result is not straightforward. For example if you phase shift $\cos(n\pi)$ to $\sin(n\pi)$ the magnitude of the FFT drops to zero, although you only time-shifted the signal.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.