TransWikia.com

DFT exercise in the book Understanding digital signal processing 3 Ed

Signal Processing Asked by Henrique Luna on October 24, 2021

I am trying to solve exercises from the book Understanding digital signal processing 3 Ed – Richard Lyons.
I will repeat the question as it is in the book:

3.3 We want to calculate an N-point DFT from a one-second compact disc (CD) audio signal of duration $x(n)$, whose sample rate is $f_s = 44.1 text{kHz}$, with a sample spacing of $1 text{Hz}$.

(a) What is the number of time samples $x(n)$ required, N?

(b) How long is the sequence time $x(n)$ measured in seconds? Tip: This part (b) of the problem is more complicated than it looks at first. Think carefully.

My answer to question (a) is $N = 44100$, since the DFT frequency resolution is $frac{f_s}{N}$. So, for $1 text{Hz}$ resolution, I think it’s quite obvious.
But, in question (b), I’m little insecure. As the hint suggests, looks like a trickier question, but I don’t know exactly why.
My first guess is that the duration of the sequence is 1 second.
Would anyone know why it wouldn’t be?
Thanks!

2 Answers

There is a very important point that is being glossed over in this question (which follows how this topic is conventinally taught) which is:

The DFT does not care what your sampling rate is.

Ultimately, every DFT calculation boils down to these parameters using conventional naming:

$$ begin{aligned} N &= SamplesPerFrame = frac{Samples}{Frame}\ k &= Bin = CyclesPerFrame = frac{Cycles}{Frame} \ n &= Sample \ omega &= Frequency = RadiansPerSample = frac{Radians}{Sample} \ 2pi &= RadiansPerCycle = frac{Radians}{Cycle} \ end{aligned} $$

The sampling rate is the conversion factor that relates the DFT values to the application.

$$ begin{aligned} f_s &= SamplesPerSecond = frac{Samples}{Second} \ Hz &= CyclesPerSecond = frac{Cycles}{Second} \ end{aligned} $$

So, my first irk is when people use "Hz" as a unit for the sampling rate and call it the "sampling frequency" (even the conventional symbol itself does this). This is incorrect units-wise and requires an implicit assumption of "one cycle per sample". This is more than a pedantic preference. The consequences are apparent with the number of times questions like this one surrounding these simple conversion come up and why, for many people, it seems to be the stumbling block that prevents further progress. Reserve the unit of Hz for referring to the signals, not the sampling, and much of this confusion can be avoided.

The two sets of definitions lets you unit check your formulas:

$$ frac{f_s}{N} = frac{frac{Samples}{Second}}{frac{Samples}{Frame}} = frac{Frames}{Second} $$

This quantity should not be designated "Hz". A conversion can be made though:

$$ frac{omega}{2pi} = frac{frac{Radians}{Sample}}{frac{Radians}{Cycle}} = frac{Cycles}{Sample} $$

$$ frac{f_s}{N} = frac{frac{omega}{2pi}}{frac{omega}{2pi}} cdot frac{f_s}{N} = frac{frac{Cycles}{Sample}}{frac{Cycles}{Sample}} cdot frac{frac{Samples}{Second}}{frac{Samples}{Frame}} = frac{frac{Cycles}{Second}}{frac{Cycles}{Frame}} = frac{Hz}{Bin} $$

Note that this equation is independent of $omega$ which means it is a proportional relationship across all the frequencies, and thus bins. So the formula

$$ f = k cdot BinWidth $$

is seen in units as

$$ Hz = Bin cdot frac{Hz}{Bin} $$

Which makes it a lot more understandable on why it works that way.

Another example is the exponent expression from the DFT and inverse DFT:

$$ frac{2pi}{N}nk = frac{frac{Radians}{Cycle}}{frac{Samples}{Frame}}cdot Sample cdot frac{Cycles}{Frame} = Radians $$

Get these straight (I'm talking to you, newbies) and your learning path will be smoother.

The OP will need this one for the actual question in the post:

$$ frac{Seconds}{Frame} = frac{frac{Samples}{Frame}}{frac{Samples}{Second}} = frac{N}{f_s} $$

Unit analysis is a lot stronger than dimensional analysis. [Edit, emphasized for RB-J's benefit.] Also, the application is not always in seconds, or time for that matter.


Response to RB-J in the comments:

From https://en.wikipedia.org/wiki/Nyquist_frequency:

"The Nyquist frequency is half of the sampling rate of a discrete signal processing system. It is named after electronic engineer Harry Nyquist. When the function domain is time, sample rates are usually expressed in samples per second, and the unit of Nyquist frequency is cycles per second (hertz)."

To go from samples per second to cycles per second, you need either a conversion factor of samples per cycle or cycles per sample.

The Nyquist frequency occurs at two samples per cycle independent of the nature of the signal, independent of the sampling rate, and independent of the DFT frame size (sample count), or even if a DFT is taken.

It can also be converted into a value of $pi$ radians per sample using a conversion factor:

$$ frac{1 text{ cycle}}{2 text{ samples}} cdot frac{2pi text{ radians}}{1 text{ cycle}} = pi frac{ text{ radians}}{ text{ sample}} $$

[Note: $2pi$ is not unitless either.]

The implicit conversion factor above can be made explicit, as in the comments:

$$ f_s = frac{f_s frac{text{samples}}{text{second}}}{1 frac{text{sample}}{text{cycle}} } = f_s frac{text{cycles}}{text{second}} = f_s text{ Hz} $$

The nature of the extension/extrapolation in either domain is tangential and irrelevant. The units of the discrete spectrum are cycles per frame. The continuous case is also irrelevant to this discussion.

Answered by Cedron Dawg on October 24, 2021

@Henrique Luna. Please forgive me. In Part (b) of the problem the words "sequence time" should "time sequence". Sorry for the confusion!

Years ago when I created that Part (b) question I was thinking about the answer to the question; "What is the time duration of an N-sample time-domain sequence?" Back then I believed the time duration under consideration to be the time difference between the sequence's first and last samples, rather than N times the time interval (1/fs) between the samples. Thinking this way leads to the conclusion that Part (b)'s answer is (N-1)*1/fs = 0.999977 seconds.

But subsequent discussion, years ago, with Dilip Sarwate convinced me that my concluded answer to 3.3 Part (b) may be somewhat valid when thinking about the time-domain but my concluded answer leads to confusion when thinking about signal durations in the context of spectrum analysis.

I now believe the 3.3 Part (b) question leads to more confusion than enlightenment. That Part (b) question was not my most well thought-out homework problem.

By the way Henrique, if you have not done so already, please have a look at the following web page: https://www.dsprelated.com/showarticle/1094.php

Answered by Richard Lyons on October 24, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP