Relation between sawtooth Fourier coefficients and its DFT I'm having some trouble with understanding the DFT of a sawtooth single period signal and its relation with sawtooth Fourier coefficients.

Let's say I have a signal
$$
s(t) = \frac{At}{T} - \frac{A}{2} \qquad t\in[0,T)
$$

If I plot its DFT real and imaginary components I have something like this


Where $A=10$, $T=1$, $N=50$ (number of samples) and the DFT is normalized by $\tau = T/N$ and $1/N/\tau$ for the inverse.

Now, the imaginary part as far as I can understand comes from the Fourier coefficients
$$
c_n = \frac{iA}{2\pi N}
$$
These coefficients (see e.g. Brigham, section 5.2) equal the fourier transform $S(t)$ scaled by $\frac{1}{T}$ and sampled at $n/T$. Given we have a discrete signal, we need to account for aliasing in the frequency space, which can be represented by repeating $c_n$ at $N$ intervals and summing with themselves, something like the following? probably missing a constant
$$
Im(S_n) = \sum_{m=-\infty}^{\infty} c_n\delta(n-mN) \qquad n \in [0,N-1]
$$

What about the non zero real part? As an afterthought I can rationalize it because the sawtooth is non zero at $t=0$, so it must have a non zero mean DFT. But if I take a sawtooth centered in $-T/2,T/2$ it's still there even if the signal crosses the origin.

I'd like to find a better relation that gets me from the Fourier series to the DFT, accounting both for the imaginary and the real part. Any pointer to good resources to help understand the whole thing would be more than welcome.

Just looking at the DFT, the real part, with my normalization should be:
$$
-\frac{A}{2}\tau\sum_{n=-\infty}^{\infty}\delta\left(f-\frac{n}{T}\right)
$$
How do I justify this result? especially the multiplication factor?

(sorry if the math is a bit flaky, I'm still trying to understand everything about DFT, Dirac combs and most of all normalization constants, every single source has them different...)
Let me use the definitions of the Fourier series and the DFT as they are commonly used in signal processing. The Fourier series of a $T$-periodic function $f(t)$ is given by

$$f(t)=\sum_{k=-\infty}^{\infty}c_ke^{j2\pi kt/T}\tag{1}$$

where $c_k$ are the complex Fourier coefficients:

$$c_k=\frac{1}{T}\int_0^Tf(t)e^{-j2\pi kt/T}dt\tag{2}$$

The length-$N$ DFT of a sequence $x[n]$ is defined by

$$X[k]=\sum_{n=0}^{N-1}x[n]e^{-j2\pi nk/N}\tag{3}$$

and the inverse DFT is

$$x[n]=\frac{1}{N}\sum_{k=0}^{N-1}X[k]e^{j2\pi nk/N}\tag{4}$$

If you sample $f(t)$ at $t=n\tau$ with $\tau=T/N$ you can approximate the integral $(2)$ by the following sum:

$$c_k\approx\frac{1}{T}\sum_{n=0}^{N-1}f(n\tau)e^{-j2\pi kn\tau /T}\tau\tag{5}$$

With $x[n]=f(n\tau)$ and $\tau=T/N$, Eq. $(5)$ can be rewritten as

$$c_k\approx\frac{1}{N}\sum_{n=0}^{N-1}x[n]e^{-j2\pi nk/N}=\frac{1}{N}X[k],\qquad |k|\le\left\lfloor \frac{N}{2}\right\rfloor\tag{6}$$

Equation $(6)$ says that the Fourier series coefficients $c_k$ of the $T$-periodic function $f(t)$ are approximated by the (scaled) DFT coefficients of the sequence $x[n]=f(n\tau)$, with $\tau=T/N$.

Of course this is also the case for your function. With

$$f(t)=A\left(\frac{t}{T}-\frac12\right),\qquad 0\le t&lt; T\tag{7} $$

and $f(t)=f(t+T)$, we get

$$x[n]=f(nT/N)=A\left(\frac{n}{N}-\frac12\right),\qquad 0\le n&lt; N \tag{8}$$

The Fourier coefficients of $f(t)$ are 

$$c_k=\frac{jA}{2\pi k}\tag{9}$$

The DFT of $x[n]$ is given by

$$X[k]=\begin{cases}-\frac{A}{2},&amp;\quad k=0\\
\frac{A}{e^{-j2\pi k/N}-1} = e^{j\pi k/N} \frac{jA/2}{\sin(\pi k/N)}=\frac{A}{2}(-1+j\cot(\pi k/N)),&amp;\quad 0&lt;k&lt;N
\end{cases}\tag{10}$$

The first thing to notice is that $f(t)$ is an odd function (with a discontinuity at $t=0$), and, consequently, its Fourier coefficients are purely imaginary. On the other other hand, the sampled version of $f(t)$ is not odd because $x[0]\neq 0$; that's why we get a (relatively small) non-zero real part in the DFT coefficients. However, as predicted by Eq. $(6)$, the scaled DFT coefficients $X[k]/N$ still approximate the Fourier coefficients quite well. The zero real part of $c_k$ is "approximated" by the value $-A/2N$, which is small for large $N$. The figure below shows the imaginary part of $X[k]/N$ (red) and the (imaginary part of the) Fourier coefficients $c_k$ (blue):



The increasing difference between $c_k$ and $X[k]/N$ with increasing $k$ is due to aliasing caused by sampling $f(t)$. Note that $f(t)$ is not band-limited, so you will always have some amount of aliasing, no matter how fast you sample. The difference in the real part ($-A/2N$ vs $0$) is caused by the fact that $f(t)$ is odd, but $x[n]$ isn't because $x[0]=f(0^+)=A/2\neq 0$.


EDIT: Here comes the derivation of the DFT of $x[n]$ defined by $(8)$. From $(3)$ we have

$$X[k]=\frac{A}{N}\sum_{n=0}^{N-1}ne^{-j2\pi nk/N}-\frac{A}{2}\sum_{n=0}^{N-1}e^{-j2\pi nk/N}\tag{a}$$

Let's first consider the case $k=0$:

$$\begin{align}X[0]&amp;=\frac{A}{N}\sum_{n=0}^{N-1}n-\frac{A}{2}\sum_{n=0}^{N-1}1\\&amp;=
\frac{A}{N}\frac{(N-1)N}{2}-\frac{AN}{2}\\&amp;=-\frac{A}{2}\end{align}\tag{b}$$

For $k\neq 0$, the second term in Eq. (a) equals zero. From the formula

$$\sum_{n=0}^{N-1}nq^n=\frac{(N-1)q^{N+1}-Nq^N+q}{(1-q)^2},\qquad q\neq 1\tag{c}$$

(which can be obtained by taking the derivative of the standard formula for a geometric series), and by noting that $e^{-j2\pi k}=1$, we get after some manipulations

$$\begin{align}X[k]&amp;=\frac{A}{N}\sum_{n=0}^{N-1}ne^{-j2\pi nk/N}\\&amp;=\ldots\\&amp;=\frac{A}{e^{-j2\pi k/N}-1},\qquad k\neq 0\end{align}\tag{d}$$

from which all other representations shown in Eq. $(10)$ can be derived quite easily.