Integral with complex exponential I am trying to solve for an integral of the following for 
$$\int_{-\infty}^{\infty} \frac{\text{exp}(2\pi j\ z a)-1}{2\pi\ j z} \text{exp}(-2\pi j z T)\, dz$$
where $a, T$ are positive numbers.
I tried to use the int function in MATLAB to integrate symbolically and MATLAB seems not able to compute it. 
Do I have to use complex analysis to solve this kind of problem? If yes, can you please guide me through?
Thanks
 A: Ok, let's see...
In a first step we rewrite the integral as
$$
\int_{-\infty}^{\infty}\frac{e^{2\pi i (a-T)q}}{2\pi i q}dq-\int_{-\infty}^{\infty}\frac{e^{-2\pi i qT}}{2\pi i q}dq
$$
First thing we note that both integrals have a singularity of order $1$ at the origin. This means that the integrals are not defined in the usual sense, but have to be interpreted as Cauchy principal part integrals denoted by $P\int=\int_R^{}$. 
Now let's try to apply Complex analysis to the first integral. Therefore we look  at the function $f(z)=\frac{e^{2\pi i(z-T)}}{2\pi z}$ where $z$ is now a complex variable. 
If $0<a-T$, $f(z)\rightarrow 0$ in the whole upper half plane (For a formal proof of this, apply the Lemma of Jordan) we therefore can write according to Cauchys theorem
$$
\underbrace{\int_{SC_+}f(z)dz}_{=0}+ \underbrace{(-i)\lim_{\epsilon\rightarrow0}\int_{\pi}^{0}f(\epsilon e^{i\phi})\epsilon e^{i\phi}d\phi}_{\text{small cemircircle to avoid the singularity}}+\underbrace{P\int_{-\infty}^{\infty}\frac{e^{2\pi i (q-T)}}{2\pi i q}dq}_{\text{the integral we are interested in}}=0
$$
Here $SC_+$ denotes a big semicircle in the upper half plane. The second integral can now be easily calculated.
$$
(-i)\lim_{\epsilon\rightarrow0}\int_{\pi}^{0}f(\epsilon e^{i\phi})\epsilon e^{i\phi}d\phi=-i\int_{\pi}^{0}d\phi=-1/2$$
And we can conclude that
$$
P\int_{-\infty}^{\infty}\frac{e^{2\pi i (q-T)}}{2\pi i q}dq=1/2 \quad \text{if} \quad a>T
$$
Applying the same analyis to the case were $0<a-T$, we have yo keep in mind, that we now have to close our contour in the lower half plane. 
$$
\underbrace{\int_{SC_-}f(z)dz}_{=0}+ \underbrace{i\lim_{\epsilon\rightarrow0}\int_{\pi}^{0}f(\epsilon e^{i\phi})\epsilon e^{i\phi}d\phi}_{\text{small cemircircle to avoid the singularity}}+\underbrace{P\int_{-\infty}^{\infty}\frac{e^{2\pi i (a-T)q}}{2\pi i q}dq}_{\text{the integral we are interested in}}=0
$$
Note the missing minus sign in front of the second integral. It stems from the fact that we now going around the singularity in counter clockwise direction.
As a result we get
And we can conclude that
$$
P\int_{-\infty}^{\infty}\frac{e^{2\pi i (a-T)q}}{2\pi i q}dq=-1/2 \quad \text{if} \quad a<T
$$
Or, putting both results together,
$$
P\int_{-\infty}^{\infty}\frac{e^{2\pi i (a-T)q}}{2\pi i q}dq=\text{sign}[a-T]/2
$$
You can now apply a very similar analysis to the second integral (somehow easier because $T>0$ and therefore no case deception) with the result that 
$$
-P\int_{-\infty}^{\infty}\frac{e^{-2\pi i qT}}{2\pi i q}dq=1/2
$$
So the complete integral is just given by 
$$
(1+\text{sign}[a-T])/2
$$
I hope everything is clear now :)
