<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/156479</link>
    <title>MATLAB Central Newsreader - Re: Strange FFT Behavior in MATLAB</title>
    <description>Feed for thread: Re: Strange FFT Behavior in MATLAB</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Thu, 20 Sep 2007 16:56:05 -0400</pubDate>
      <title>Re: Strange FFT Behavior in MATLAB</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/156479#393244</link>
      <author> robert bristow-johnson</author>
      <description>On Sep 20, 8:01 am, &quot;patrickjennings&quot; &amp;lt;patrick.t.jenni...@gmail.com&amp;gt;&lt;br&gt;
wrote:&lt;br&gt;
&amp;gt; I think we can all agree that FFT { x*(n) } = X*(N-k),&lt;br&gt;
&lt;br&gt;
actually the folks at The Math Works do not agree.  as fatnbafan said,&lt;br&gt;
MATLAB is hard-wired or hard-coded so that the indices of all arrays&lt;br&gt;
begin with 1, not 0 as it should for the DFT or FFT.&lt;br&gt;
&lt;br&gt;
so in MATLAB, if N=length(x); y = conj(x);  X = fft(x);  Y = =&lt;br&gt;
fft(y);  then&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;Y(k+1) = conj( X(mod(N-k+1, N)) );         % for  0 &amp;lt;= k &amp;lt; N&lt;br&gt;
&lt;br&gt;
or stated so elegantly that it's amazing we all don't just sing the&lt;br&gt;
praises of MATLAB,&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;Y(k) = conj( X(mod(N-k+2, N) );            % for  1 &amp;lt;= k &amp;lt;= N&lt;br&gt;
&lt;br&gt;
gee, isn't that elegant?&lt;br&gt;
&lt;br&gt;
r b-j&lt;br&gt;
&lt;br&gt;
&amp;gt; or the FFT of the&lt;br&gt;
&amp;gt; conj of x(n) is the conj of the reversed version of the FFT of x(n).&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; But in MATLAB if a= [1+2j 3+4j 5+6j 7+8j] then&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; fft(conj(a))          = [16+20j    -8+0j    -4-4j    0-8j]&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; and&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; conj(fliplr(fft(a))) = [-8+0j      -4-4j    0-8j   16+20j]&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Any ideas?  Another engineer and I spent most of a day looking at the&lt;br&gt;
&amp;gt; model before finding the fundamental problem.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Cheers&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; /Patrick</description>
    </item>
    <item>
      <pubDate>Sat, 16 Aug 2008 03:40:20 -0400</pubDate>
      <title>Re: Strange FFT Behavior in MATLAB</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/156479#510864</link>
      <author>Andy Robb</author>
      <description>When analyzing (real) time series data, the complex&lt;br&gt;
frequency spectrum is symmetric in the real part and&lt;br&gt;
anti-symmetric in the imaginary part.&lt;br&gt;
&lt;br&gt;
Way back in Matlab 3, when memory and performance were at a&lt;br&gt;
premium, I formulated MEX files that used this symmetry to&lt;br&gt;
reduce the data size.&lt;br&gt;
&lt;br&gt;
It is possible to arrange a real time series into a complex&lt;br&gt;
series of half the length and post process the fft output to&lt;br&gt;
get the spectrum. Or the other way around - arranging half&lt;br&gt;
the spectrum into a real series. For lengths of a power of&lt;br&gt;
2, Matlab 3 used a fast Cooley Tukey algorithm which was&lt;br&gt;
most efficient going from real to complex.&lt;br&gt;
&lt;br&gt;
For even lengths that are not a power of 2, Matlab 3 only&lt;br&gt;
used a complex FFT. In those cases, I took the real series&lt;br&gt;
(either time series or half the spectrum), and arranged it&lt;br&gt;
as a complex series of half the length. Again, I could take&lt;br&gt;
half a frequency spectrum and rearrange it as a real series&lt;br&gt;
then rearrange it again as a complex series of half the length.&lt;br&gt;
&lt;br&gt;
It sounds more complicated than it was and it ran several&lt;br&gt;
times faster.</description>
    </item>
  </channel>
</rss>

