# closed-form analytical expression for DFT coefficients

I want to calculate the closed-form analytical expression for DFT coefficients of the following problem

$$x[n]=\left\{ \begin{array}{ll} 1 & \mbox{if } 0\leq n \leq M-1 \\ 0 & \mbox{if }M \leq n \leq L-1 \end{array} \right.$$ Write out the closed-form analityical expression for its DFT coefficients $X[k]$.

I always get the wrong solution... My attempted solution is: $$\frac{1 - e^{-j\pi k \frac{M}{L}} }{ 1 - e^{-j\pi k \frac{1}{L}} }$$

What is the correct solution and why?

The DFT of a vector of size L is L samples of the Fourier transform of the signal:

$$X[k] = X(e^{j\theta})|_{\theta = 2\pi k/L}$$

So now we need to calculate the FT of $x[n]$:

$$X(e^{j\theta}) = \sum_{n=0}^{n=M-1} e^{-j n \theta}$$

This is a geometric series which results in:

$$X(e^{j\theta}) = \frac{1 - e^{-jM\theta}}{1 - e^{-j\theta}}$$

Evaluate on the DFT samples to give:

$$X[k] = \frac{1 - e^{-j M 2 \pi k/L}}{1 - e^{-j 2 \pi k / L}}$$

You can extract half phase from top and bottom to give:

$$X[k] = e^{-j(M-1)\pi k/L} \frac{\sin(M \pi k/L)}{\sin(\pi k/L)}$$

• E^(-j*(M-1)*pik/L)*sin(Mpik/L)/sin(pik/L) Commented May 23, 2020 at 17:41

As per my analysis, the answer should be

I used the DFT formula for a discrete sequence

I integrated the above in two parts.

First from n=0 to M-1

and

Second from n=M to L-1

As per the given conditions the xn will be zero for the second part

This reduces to a geometric series

where

$$a=1$$

and

$$r=e^{-j*2*pi*k/L}$$

and $$n=M-1$$

• welcome to the DSP SE, Sau001. in the future, it would be better to do all of your equations with $\LaTeX$. Commented Jun 20, 2021 at 23:58
• @robertbristow-johnson Absolutely! Still learning LatEx. Commented Jun 21, 2021 at 8:20