0
$\begingroup$

It is known that: $$ \mathcal{F}\{\cos(2\pi t)\}=\frac{\delta(f-1)+\delta(f+1)}{2} $$ However, on MATLAB, I used F=fftshift(fft(x))/N; to obtain the FT of $\cos(2\pi t)$ and I obtained the following: enter image description here

My question is why does each $\delta$ appear to be made up of two thin close parallel lines. Note that I have used $1024$ sample points and constructed $f$ a vector from $-51.2$Hz to $51.2$Hz and $t$ a vector from $-5$ to $5$.

$\endgroup$
1
$\begingroup$

That's because Matlab preforms FFT, the formula that you referred to is the FT of your signal, the difference between the two can be derived by convolving the DTFT (which has the same form of the FT) with the sinc function, which in your case is close to a delta function. For that reason you get a slight different frequancy domain from the theory you would expect

$\endgroup$
5
  • $\begingroup$ Oh, so the fft computes the DFT. This makes sense now thank you :) $\endgroup$
    – SPARSE
    Apr 19 at 7:50
  • $\begingroup$ Yup, fft us algorithem for the dft $\endgroup$
    – Ran Greidi
    Apr 19 at 10:21
  • $\begingroup$ Sorry to bring this up again but I wanted to ask, just observing the weird shape of this graph, why is it continuous knowing that DFT outputs a discrete signal? also is the very very low frequnecy spectrum between the two sharp impulses are what we call "frequency leackage"? @Ran Greidi $\endgroup$
    – SPARSE
    Apr 19 at 20:50
  • $\begingroup$ @deerclaysup Try plotting using stem rather than plot. plot joins samples with a straight line. $\endgroup$
    – MBaz
    Apr 20 at 21:24
  • $\begingroup$ The DFT is finite samples of the DTFT. The whole ponit of it is to allow a computer to work with a finite number of samples. Matlab plots those samples as a graph using plot function, you can try using stem to see that, also you can plot the theory spectrum and plot on top of it the fft you have gotten just to make sure you understand what I mean. Note that by using a large number of samples you get close to tge theory spectrun.. $\endgroup$
    – Ran Greidi
    Apr 21 at 6:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.