I'm trying to plot the phase of Fourier transform of the function below:
\begin{gather*} x[n] = 2e^{-0.9|n|} \: \: n \in [-5,5]\\ x[n] = 0 \:\: n \notin [-5,5] \end{gather*}
which is equal to the function below:
\begin{gather*} x[n] = 2e^{-0.9|n|} \times \mathrm{rect}(5) \end{gather*} so
so I calculated the Fourier transform like below:
\begin{gather*} x[n] = 2e^{-0.9|n|} \times \mathrm{rect}(5)\\ y[n] = \alpha^{|n|} \:\: |\alpha |< 1 \\ Y[e^{jw}] = \frac{1-\alpha^2}{1+\alpha^2-2\alpha \cos(w)}\\ \longrightarrow x[n] = 2(\frac{1}{e^{0.9}})^{|n|} \longrightarrow\\ X[e^{jw}] = \frac{1}{2\pi} 2 \frac{1-(\frac{1}{e^{0.9}})^2}{1+(\frac{1}{e^{0.9}})^2-2(\frac{1}{e^{0.9}}) \cos(w)} * \frac{\sin\left(w(\frac{1}{2}+5\right)}{\sin\left(\frac{w}{2}\right)}\\ X[e^{jw}] = \frac{1}{\pi} \frac{1-(\frac{1}{e^{0.9}})^2}{1+(\frac{1}{e^{0.9}})^2-2(\frac{1}{e^{0.9}}) \cos(w)} * \frac{\sin\left(\frac{11w}{2}\right)}{\sin\left(\frac{w}{2}\right)} \end{gather*} in
in which * represents a convolution so as. As you see I shouldn't get linear phase because both sides of the convolution doesn'tdon't even have phase. However, when I draw it in Matlab I get linear phase and I'm stuck. I don't know why.
x = @(t) 2*exp(-0.9 .* abs(t)).* ((t<= 5) & (t>= -5));
time_step =1;
t = -5:time_step:5;
yfft = fftshift(fft(x(t)));
f = linspace(-pi, pi, numel(yfft));
plot(f,unwrap(angle(yfft)));
xlim([-pi,pi]);
I also added N number to fftFFT so it padpads the function bywith zero, but the result is same as before.
The plot is like above and phase is linear which it shouldn't be.