Thread Subject: Strange FFT Behavior in MATLAB

Subject: Strange FFT Behavior in MATLAB

From: robert bristow-johnson

Date: 20 Sep, 2007 16:56:05

Message: 1 of 2

On Sep 20, 8:01 am, "patrickjennings" <patrick.t.jenni...@gmail.com>
wrote:
> I think we can all agree that FFT { x*(n) } = X*(N-k),

actually the folks at The Math Works do not agree. as fatnbafan said,
MATLAB is hard-wired or hard-coded so that the indices of all arrays
begin with 1, not 0 as it should for the DFT or FFT.

so in MATLAB, if N=length(x); y = conj(x); X = fft(x); Y = =
fft(y); then

   Y(k+1) = conj( X(mod(N-k+1, N)) ); % for 0 <= k < N

or stated so elegantly that it's amazing we all don't just sing the
praises of MATLAB,

   Y(k) = conj( X(mod(N-k+2, N) ); % for 1 <= k <= N

gee, isn't that elegant?

r b-j

> or the FFT of the
> conj of x(n) is the conj of the reversed version of the FFT of x(n).
>
> But in MATLAB if a= [1+2j 3+4j 5+6j 7+8j] then
>
> fft(conj(a)) = [16+20j -8+0j -4-4j 0-8j]
>
> and
>
> conj(fliplr(fft(a))) = [-8+0j -4-4j 0-8j 16+20j]
>
> Any ideas? Another engineer and I spent most of a day looking at the
> model before finding the fundamental problem.
>
> Cheers
>
> /Patrick


Subject: Strange FFT Behavior in MATLAB

From: Andy Robb

Date: 16 Aug, 2008 03:40:20

Message: 2 of 2

When analyzing (real) time series data, the complex
frequency spectrum is symmetric in the real part and
anti-symmetric in the imaginary part.

Way back in Matlab 3, when memory and performance were at a
premium, I formulated MEX files that used this symmetry to
reduce the data size.

It is possible to arrange a real time series into a complex
series of half the length and post process the fft output to
get the spectrum. Or the other way around - arranging half
the spectrum into a real series. For lengths of a power of
2, Matlab 3 used a fast Cooley Tukey algorithm which was
most efficient going from real to complex.

For even lengths that are not a power of 2, Matlab 3 only
used a complex FFT. In those cases, I took the real series
(either time series or half the spectrum), and arranged it
as a complex series of half the length. Again, I could take
half a frequency spectrum and rearrange it as a real series
then rearrange it again as a complex series of half the length.

It sounds more complicated than it was and it ran several
times faster.

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com