Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
is normalizing FFT magn spectrum different for

Subject: is normalizing FFT magn spectrum different for

From: robert bristow-johnson

Date: 4 Nov, 2010 05:59:18

Message: 1 of 2

On Nov 3, 1:55 pm, glen herrmannsfeldt <g...@ugcs.caltech.edu> wrote:
> all4dsp <all4dsp@n_o_s_p_a_m.comcast.net> wrote:
> > Let's say I compute the FFT magnitude spectrum of a variable X(n) in
> > Matlab, where X(n) has indices n running from 1 to N.
>
> Assuming Matlab works the usual way...
>
> > The magnitude spectrum is plotted for indices n = 2 (ignoring DC index n=1
> > for now) to n = N/2 + 1 (e.g. the Nyquist frequency bin).
> > To get the normalization correct, should the Nyquist-frequency bin's
> > magnitude be cut in half, because the Nyquist bin is not mirrored/reflected
> > like the other bins (except DC bin)?
>
> I don't believe so.
>
> Consider the IFFT with as input all zeros except for the N/2+1 bin.
> Then consider all zeros except for one other bin, other than n=1.
> Compare the results, such as computing the RMS value.
>
> There is some asymmetry in the FFT/IFFT regarding n=1 and n=N/2+1.

boy, isn't it just obvious that MATLAB screwed up the indexing
convention on this? now, in order to speak "Matlab", Glen is
accommodating their dumb and hard-wired indexing origin by adding 1 to
everything. it's bad enough we have to do that to communicate to
MATLAB, it's just ridiculous that, for the sake of context, we end up
doing so to communicate to each other.

just a shame.

r b-j

Subject: is normalizing FFT magn spectrum different for Nyquist-frequency's bin?

From: Glen Herrmannsfeldt

Date: 4 Nov, 2010 06:18:04

Message: 2 of 2

In comp.dsp robert bristow-johnson <rbj@audioimagination.com> wrote:
(snip, then I wrote)

>> There is some asymmetry in the FFT/IFFT regarding n=1 and n=N/2+1.
 
> boy, isn't it just obvious that MATLAB screwed up the indexing
> convention on this? now, in order to speak "Matlab", Glen is
> accommodating their dumb and hard-wired indexing origin by adding 1 to
> everything. it's bad enough we have to do that to communicate to
> MATLAB, it's just ridiculous that, for the sake of context, we end up
> doing so to communicate to each other.

Well, I started Fortran programming before 1977, when array
started at 1. I did find C array indexing starting at 0 to be
much more natural much of the time, though.

Still, it isn't so obvious by now that Matlab shouldn't have an
option for array origin.

-- glen

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us