Comments on: Plotting the DTFT using the output of fft https://blogs.mathworks.com/steve/2010/06/25/plotting-the-dtft-using-the-output-of-fft/?s_tid=feedtopost Retired from MathWorks in 2024 after 30 years of service. Can now be found at MATLAB Central, https://hornjourney.com, and https://matrixvalues.com. MathWorks career included image processing, toolbox development, MATLAB development and design, development team management, MATLAB design standards, Steve on Image Processing blog (https://blogs.mathworks.com/steve). Co-author of Digital Image Processing Using MATLAB (https://www.imageprocessingplace.com/DIPUM-3E/dipum3e_main_page.htm). French horn enthusiast, member of Concord Orchestra and Melrose Symphony, member of the board of Cormont Music and the Kendall Betts Horn Camp. Tue, 29 Oct 2019 17:30:02 +0000 hourly 1 https://wordpress.org/?v=6.2.2 By: Starstrike https://blogs.mathworks.com/steve/2010/06/25/plotting-the-dtft-using-the-output-of-fft/#comment-23417 Thu, 02 Sep 2010 10:06:08 +0000 https://blogs.mathworks.com/steve/2010/06/25/plotting-the-dtft-using-the-output-of-fft/#comment-23417 My first introduction to the unwrap function – it’s one I use so often I’d created a subfunction of my own to do it, without discovering ‘unwrap’. I can at least console myself that my custom version is faster – but I rarely call it multiple times, so might just switch to the greater redundancy of unwrap.

Interesting to see that you can get the DTFT from the DFT; oddly – using DFTs all the time – I was looking for a fast way to calculate the DTFT recently.

Ding’s code, as implied, would need a separate definition of w4 in the case of odd N, eg for unpadded DFTs.

]]>
By: Ding https://blogs.mathworks.com/steve/2010/06/25/plotting-the-dtft-using-the-output-of-fft/#comment-23404 Sun, 29 Aug 2010 18:02:22 +0000 https://blogs.mathworks.com/steve/2010/06/25/plotting-the-dtft-using-the-output-of-fft/#comment-23404 Nice Post, Steve. I learned something from the use of unwrap function here.

Regarding to labeling the frequency axis of FFT spectrum output, there might be a much easy way like this:

w4=2*pi*(-N/2:N/2-1)/N;
figure
plot(w4/pi,abs(fftshift(x)));
xlabel(radians / \pi);

Normally, N is chosen even in FFT zero padding…

]]>
By: Steve https://blogs.mathworks.com/steve/2010/06/25/plotting-the-dtft-using-the-output-of-fft/#comment-23259 Mon, 12 Jul 2010 15:34:35 +0000 https://blogs.mathworks.com/steve/2010/06/25/plotting-the-dtft-using-the-output-of-fft/#comment-23259 SanguineCat—Oops, I didn’t explain that quite right. The function unwrap “fixes” discontinuities by adding multiples of 2*pi. The thing you are trying to unwrap isn’t made up of phase angles and the discontinuity isn’t close to a multiple of 2*pi, so unwrap is the wrong thing to use.

]]>
By: Steve https://blogs.mathworks.com/steve/2010/06/25/plotting-the-dtft-using-the-output-of-fft/#comment-23258 Mon, 12 Jul 2010 14:57:32 +0000 https://blogs.mathworks.com/steve/2010/06/25/plotting-the-dtft-using-the-output-of-fft/#comment-23258 SanguineCat—The function unwrap is meant for correcting discontinuities of phase angles caused by a branch cut in the complex plane. It is looking for discontinuities of greater than pi, and your example doesn’t have any discontinuities that big. You could try reducing the “jump tolerance,” which is the optional second input argument to unwrap.

]]>
By: SanguineCat https://blogs.mathworks.com/steve/2010/06/25/plotting-the-dtft-using-the-output-of-fft/#comment-23254 Wed, 07 Jul 2010 23:46:27 +0000 https://blogs.mathworks.com/steve/2010/06/25/plotting-the-dtft-using-the-output-of-fft/#comment-23254 I went through the Fourier articles yesterday, and they’re very helpful. Thanks Steve.

The following question may be due to my inability to understand the unwrap function correctly. Does anyone know why the unwrapping the following code does not produce a linear result?

Fs = 20;
N=100;
F=[0:N-1]/N*Fs;
plot(unwrap(fftshift(F)-Fs))

]]>
By: OysterEngineer https://blogs.mathworks.com/steve/2010/06/25/plotting-the-dtft-using-the-output-of-fft/#comment-23228 Tue, 29 Jun 2010 09:08:45 +0000 https://blogs.mathworks.com/steve/2010/06/25/plotting-the-dtft-using-the-output-of-fft/#comment-23228 Steve,

Thanks for another well written column.

]]>