bugGNU Octave - Bugs: bug #49436, fftshift: incorrect frequency...

 
 

bug #49436: fftshift: incorrect frequency scale in help text

Submitter:  Martin Kunz <mkunz>
Submitted:  Tue 25 Oct 2016 08:54:50 AM UTC
   
 
Category:  Documentation Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Documentation
Status:  Fixed Assigned to:  None
Originator Name:  mkunz Open/Closed:  * Closed
Release:  * 4.2.0-rc2 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 26 Oct 2016 09:02:53 PM UTC, comment #7: 
Mike Miller <mtmiller>
Group Member
Wed 26 Oct 2016 06:45:35 AM UTC, comment #6: 

Right, that would be clearer.

Martin Kunz <mkunz>
Wed 26 Oct 2016 12:23:37 AM UTC, comment #5: 

I think the clearest change would be to redefine df so that it corresponds to what df actually is, right?


where df = 1 / (N * dt).


Mike Miller <mtmiller>
Group Member
Tue 25 Oct 2016 05:53:02 PM UTC, comment #4: 

Ok, let's give it a try:



f = [ -(ceil((N-1)/2):-1:1)*df 0 (1:floor((N-1)/2))*df ]/N



One can also copy the full line from the original post. Or place the cursor in there and hit the "End" key.

Martin

Martin Kunz <mkunz>
Tue 25 Oct 2016 05:35:43 PM UTC, comment #3: 

Try with the

+nomarkup+
  and
-nomarkup-


tags.
(And now crossing fingers / hoping that this comes out OK....)

Philip Nienhuis <philipnienhuis>
Group Member
Tue 25 Oct 2016 08:58:33 AM UTC, comment #2: 

Goodness! Now the asterisks disappear and make part of the formula printed in bold...

So in words: The frequency vector given in the help text has to be divided by N, I think.

Martin Kunz <mkunz>
Tue 25 Oct 2016 08:56:26 AM UTC, comment #1: 

Looks like the verbatim environment hides the important part in my suggested correction. It should read:

f = [ -(ceil((N-1)/2):-1:1)*df 0 (1:floor((N-1)/2))*df ]/N

Martin Kunz <mkunz>
Tue 25 Oct 2016 08:54:50 AM UTC, original submission:  

The help text for fftshift states:


If X is a vector of N elements corresponding to N time samples
spaced by dt, then 'fftshift (fft (X))' corresponds to frequencies

   f = [ -(ceil((N-1)/2):-1:1)*df 0 (1:floor((N-1)/2))*df ]

where df = 1 / dt.


I think this is wrong. Let N = 10 and dt = 1, then f would range from -5 to +5, whereas the Nyquist frequency would be 0.5.
To my mind the correct formula is


   f = [ -(ceil((N-1)/2):-1:1)*df 0 (1:floor((N-1)/2))*df ]/N


Martin Kunz <mkunz>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by rik5 (Updated the item)
  • -email is unavailable- added by mkunz (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-10-26 mtmiller StatusNone Fixed
        Open/ClosedOpen Closed
    2016-10-25 rik5 Operating SystemMicrosoft Windows Any

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code