# DFT and integer valued basis functions'sf requencies

In Matlab the function

W=dftmtx(N)


gives the DFT matrix of size N.

Each row is computed for an integer frequency k. $$W_{k,n} = e^{-i2\pi kn/N}$$, k-th frequency, nth sample if I am not mistaken.

I remember that I ve learned that the frequencies (k) are integers for the DFT. For the continuous Fourier transform it is a continuum of freq and times so everything they are real numbers both.

Could you develop on the usage of integer frequencies? and possibly relate it to the DCT where it seems to me that, e.g. the second basis vector is like half a cycle (as shown on my plot), and half a cycle is like a fractional frequency?

code for plot:

DCTm=dctmtx(8);
DFTm=dftmtx(8);
figure;plot(DCTm(2,:));hold on;plot(real(DFTm(2,:)))

• integer indexes are not the same as integer frequencies – user28715 Aug 2 '19 at 15:51
• Ok. I se what you mean but DFT has integer frequencies, what to say about that? – SheppLogan Aug 2 '19 at 17:31

Could you develop on the usage of integer frequencies?

When dealing with sampled discrete signals, there can only be an integer amount of resolvable frequencies within a captured interval.

When you take an $$x(t), t \in \mathbb{R}$$ and apply sample-and-hold on it at some sampling frequency $$Fs$$, it is turned into an $$x \left[n \cdot \frac{1}{Fs} \right ], n \in \mathbb{N}$$.

Theoretically, when $$t \in \mathbb{R}$$, you can "interrogate" any time instance or interval of $$x$$. But after sampling, when $$n \in \mathbb{N}$$, the smallest interval you can interrogate from your signal is $$\frac{1}{Fs}$$ or between successive samples $$n, n+1$$.

Even if you tried to sample faster after the sample-and-hold, the value you would get would be the last known value from the last time the sampling took place.

Therefore, within a block of $$N$$ samples, you get $$N$$ resolvable frequencies. Even if you tried to evaluate the Discrete Fourier Transform in more than the available $$N$$ frequencies, all that you would get would be interpolated values between the $$N$$ resolvable bins of it.

Which brings us to what Stanley Pawlukiewicz remarks: The fact that $$n$$ is integer, does not mean that you can only represent integer frequencies. Only that you can represent a fixed amount of them.

Just as you can only "see" $$n$$ and then $$n+1$$ discrete time instances of $$x$$, so you can only resolve some $$f, f+ \frac{Fs}{N}$$ discrete frequencies within it, where $$N$$ is the amount of samples you have collected.

...possibly relate it to the DCT where it seems to me that, e.g. the second basis vector is like half a cycle (as shown on my plot), and half a cycle is like a fractional frequency?

I hope that it is clear from the above discussion that "...half a cycle..." can well be N samples of some $$f$$ sampled at the right $$Fs$$ (?).

Hope this helps.

• Thanks for the discussion. However I still don't see why does the 2nd basis vector of DCT look like a " half a cycle" whereas DFT ones (all) look like* "made of full cycles" if you see what I mean? *again their values when plotted – SheppLogan Aug 5 '19 at 20:40
• *regardless of how finely it is sampled e.g. dctm=dctmtx(8) or dctm=dctmtx(512) for example, the shape of dctm(2,:) always looks like this "half cycle" if you see what i mean ? -> Which leads me to consider that it "measures" /measure the similarity - so to speak - with a "half cycle" (since the inner product is kind of like measuring similarity, in a sense) ? – SheppLogan Aug 6 '19 at 11:30
• @Machupicchu Is your question about the argument of the trigonometric function here? Because it is not the same as the DFT (i.e. $2 \pi$). – A_A Aug 6 '19 at 21:16
• Well I don't really know how to formulate it ... it is really about this "idea" of half-cycle that you can visually see on my figure ? – SheppLogan Aug 7 '19 at 14:38