I have been buzzed about this issue for more than an hour. I have been tasked to execute a simple DTFT task using MATLAB for the signal $x(t):=\cos(2\pi f_{0}t)$. Assuming we are sampling at a rate of $200\operatorname{Hz}$ at $0.5\operatorname{sec}$ i.e., we require $N=100$ sampled points. Furthermore, let $f_{0}:=55\operatorname{Hz}$.
The time interval specified is $5\times10^{-3}\leq t\leq 0.5$ in seconds. Using MATLAB I first defined $t$ as a vector of size $100\times 1$. Therefore, let t=linspace(5e-3,0.5,100)
so that x=cos(2*pi*55*t)
in addition to the frequency vector f=linspace(-fs/2,fs/2,100)
where fs=200
and then finally, execute the command X=fftshift(fft(x/100))
.
Plotting the magnitude spectrum on MATLAB using $\mathsf{stem(f,abs(X))}$ produces the following result :
While this simply accomplishes this task, I am not satisfied with the result without understand the following :
- Why are there low-quantized frequencies in between and out of $f=\pm 55\operatorname{Hz}$? We know by theory that $x[n]=\cos(2\pi f_0n)\xrightarrow{\mathscr{F}}0.5[\delta(f-f_{0})+\delta(f+f_{0})]$, this also leads me to the second question.
- I defined DFT as $$X[k]:=\frac{1}{N}\sum_{n=0}^{N}x[n]\exp\left(-j\frac{2\pi kn}{N}\right)\tag{1}$$ In theory, the amplitude should lie exactly at $0.5\operatorname{Hz}$, this is in contrast with the observation that the amplitude is about $0.33$. Why is this occuring? The way I defined DFT should scale the magnitude of the output to $0.5$
- Why does it take two points to represent $\delta(f-55)$ and two points to represent $\delta(f+55)$? We should expect one sharp delta. I am sampling even-number of points could this be the issue?
Note that for the first question, I did a bit of research on the web and I received some results about spectral leakage, It seems to hint about some aspects related to the number of oscillations occurring with respect to the number of sampled points.
Another note: Having these three questions answered would grant me the ability to understand more about how frequency spectrum is affected by number of sampled points, it will also allow me to get introduced to new concepts such as spectral leakage if that's the case for my first question, it will also help me manipulate DTFT more while understanding the variations such as changing $f_{0}$ and $N$ and observing how the frequency domain reacts.