<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/255291</link>
    <title>MATLAB Central Newsreader - fft for beginners</title>
    <description>Feed for thread: fft for beginners</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>Sat, 04 Jul 2009 06:44:02 -0400</pubDate>
      <title>fft for beginners</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/255291#662571</link>
      <author>JMMO MartinOlalla</author>
      <description>Hi all,&lt;br&gt;
&lt;br&gt;
I am just starting doing fft with MatLab. No previous experience.&lt;br&gt;
&lt;br&gt;
I am working with 2^19 experimental data points extending over some 50hours arranged as a vector X whose length is 2^19. I am getting on the fft since I need to study correlations and convutions in sets of different experimental data (so ifft will be also needed)&lt;br&gt;
&lt;br&gt;
Since the rate of time in the experimental data is known I can control easily what the index of X means: say, from X(1,i) to X(1,i+1) there are 0.11ms while, of course, the first datapoint is t=0.&lt;br&gt;
&lt;br&gt;
Now, I got: W=fft(X), which is again a vector whose length is 2^19.&lt;br&gt;
&lt;br&gt;
My question is how is the index of this vector W running in the frequency domain? Say, low index means low frequency? frequencies are equally spaced? on what basis?&lt;br&gt;
&lt;br&gt;
Also, I would like to know what would I be doing if I fftshift the vector W.&lt;br&gt;
&lt;br&gt;
Thanks in advance.</description>
    </item>
    <item>
      <pubDate>Sat, 04 Jul 2009 15:33:01 -0400</pubDate>
      <title>Re: fft for beginners</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/255291#662608</link>
      <author>Luca Zanotti Fragonara</author>
      <description>Low indexes means low frequencies? &lt;br&gt;
&lt;br&gt;
Yes, but remember that the second half of W contains negative frequencies (which usually are useless, but depends from your field of applications).&lt;br&gt;
&lt;br&gt;
Frequency are equally spaced?&lt;br&gt;
&lt;br&gt;
Yes.&lt;br&gt;
&lt;br&gt;
On what basis?&lt;br&gt;
&lt;br&gt;
It depends from your sampling time. If you didn't choose the nfft option, the fft command uses the default option, which calculates a fft which has length equal the length of X (your array).&lt;br&gt;
So in order to build your frequency axis, you will have to use:&lt;br&gt;
f = Fs/2*linspace(0,1,NFFT/2+1);&lt;br&gt;
&lt;br&gt;
Where Fs is your sampling frequency and NFFT is the length of your fft.&lt;br&gt;
&lt;br&gt;
Greetings,&lt;br&gt;
&lt;br&gt;
Luca&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&quot;JMMO MartinOlalla&quot; &amp;lt;none@us.es&amp;gt; wrote in message &amp;lt;h2mtni$phl$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi all,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I am just starting doing fft with MatLab. No previous experience.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I am working with 2^19 experimental data points extending over some 50hours arranged as a vector X whose length is 2^19. I am getting on the fft since I need to study correlations and convutions in sets of different experimental data (so ifft will be also needed)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Since the rate of time in the experimental data is known I can control easily what the index of X means: say, from X(1,i) to X(1,i+1) there are 0.11ms while, of course, the first datapoint is t=0.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Now, I got: W=fft(X), which is again a vector whose length is 2^19.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; My question is how is the index of this vector W running in the frequency domain? Say, low index means low frequency? frequencies are equally spaced? on what basis?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Also, I would like to know what would I be doing if I fftshift the vector W.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks in advance.</description>
    </item>
    <item>
      <pubDate>Sat, 04 Jul 2009 18:43:05 -0400</pubDate>
      <title>Re: fft for beginners</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/255291#662623</link>
      <author>Greg</author>
      <description>On Jul 4, 2:44&#160;am, &quot;JMMO MartinOlalla&quot; &amp;lt;n...@us.es&amp;gt; wrote:&lt;br&gt;
&amp;gt; Hi all,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I am just starting doingfftwith MatLab. No previous experience.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I am working with 2^19 experimental data points extending over some 50hours arranged as a vector X whose length is 2^19. I am getting on thefftsince I need to study correlations and convutions in sets of different experimental data (so ifft will be also needed)&lt;br&gt;
&lt;br&gt;
N     =   2^19           %  524288&lt;br&gt;
tmax =  50*60*60     % 180000&lt;br&gt;
dt     =  tmax/(N-1)    %  0.3433&lt;br&gt;
&lt;br&gt;
t      =   dt*(0:N-1);&lt;br&gt;
T     =   N*dt&lt;br&gt;
t      =   0:dt:T-dt;&lt;br&gt;
&lt;br&gt;
Fs   =  1/dt&lt;br&gt;
df    =  1/T&lt;br&gt;
Fs   =  N*df&lt;br&gt;
f      =  df*(0:N-1);&lt;br&gt;
f      =  0:df:Fs-df;&lt;br&gt;
&lt;br&gt;
&amp;gt; Since the rate of time in the experimental data is known I can control easily what the index of X means: say, from X(1,i) to X(1,i+1) there are 0.11ms while, of course, the first datapoint is t=0.&lt;br&gt;
&lt;br&gt;
You lied. If&lt;br&gt;
&lt;br&gt;
dt = 1.1e-4&lt;br&gt;
&lt;br&gt;
% then&lt;br&gt;
&lt;br&gt;
tmaxsec = (N-1)*dt        % 57.6716 seconds&lt;br&gt;
&lt;br&gt;
tmaxhr = tmaxsec/3600  % 0.0160 hours (NOT ~ 50)&lt;br&gt;
&lt;br&gt;
did you mean tmax ~ 50 sec ???&lt;br&gt;
&lt;br&gt;
Anyway, go back and recalculate all of the above quantities&lt;br&gt;
&lt;br&gt;
&amp;gt; Now, I got: W=fft(X), which is again a vector whose length is 2^19.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; My question is how is the index of this vector W running in the frequency domain? Say, low index means low frequency? frequencies are equally spaced? on what basis?&lt;br&gt;
&lt;br&gt;
See above formula for f&lt;br&gt;
&lt;br&gt;
&amp;gt; Also, I would like to know what would I be doing if I fftshift the vector W.&lt;br&gt;
&lt;br&gt;
Then the N index periodicity is used to shift all frequences&lt;br&gt;
at the Nyquist frequency Fs/2 = N*df/2 and above to negative&lt;br&gt;
frequencies&lt;br&gt;
&lt;br&gt;
fb = df*(-N/2:N/2-1);&lt;br&gt;
&lt;br&gt;
Hope this helps.&lt;br&gt;
&lt;br&gt;
Greg</description>
    </item>
    <item>
      <pubDate>Sat, 04 Jul 2009 18:57:23 -0400</pubDate>
      <title>Re: fft for beginners</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/255291#662625</link>
      <author>Greg</author>
      <description>PLEASE DO NOT TOPPOST!&lt;br&gt;
&lt;br&gt;
On Jul 4, 11:33&#160;am, &quot;Luca Zanotti Fragonara&quot; &amp;lt;Luca_Zano...@libero.it&amp;gt;&lt;br&gt;
wrote:&lt;br&gt;
&amp;gt; Low indexes means low frequencies?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Yes, but remember that the second half of W contains negative frequencies (which usually are useless, but depends from your field of applications).&lt;br&gt;
&lt;br&gt;
In particular, if X is real, the frequency components&lt;br&gt;
above the Nyquist freqency are redundant because of&lt;br&gt;
conjugate symmetry about the Nyquist frequency.&lt;br&gt;
&lt;br&gt;
Hope this helps.&lt;br&gt;
&lt;br&gt;
Greg</description>
    </item>
    <item>
      <pubDate>Mon, 06 Jul 2009 08:53:01 -0400</pubDate>
      <title>Re: fft for beginners</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/255291#662814</link>
      <author>Etaoin </author>
      <description>Thank you very much to Greg and and Luca; much more clear now.&lt;br&gt;
&lt;br&gt;
Yes, I 'lied', it was not 0.11ms. Actually it was 0.11111111111mh=4s.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Greg &amp;lt;heath@alumni.brown.edu&amp;gt; wrote in message &amp;lt;b03e0cd2-9bba-477e-b2d0-37431867c269@j32g2000yqh.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; On Jul 4, 2:44?am, &quot;JMMO MartinOlalla&quot; &amp;lt;n...@us.es&amp;gt; wrote:&lt;br&gt;
&amp;gt; &amp;gt; Hi all,&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; I am just starting doingfftwith MatLab. No previous experience.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; I am working with 2^19 experimental data points extending over some 50hours arranged as a vector X whose length is 2^19. I am getting on thefftsince I need to study correlations and convutions in sets of different experimental data (so ifft will be also needed)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; N     =   2^19           %  524288&lt;br&gt;
&amp;gt; tmax =  50*60*60     % 180000&lt;br&gt;
&amp;gt; dt     =  tmax/(N-1)    %  0.3433&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; t      =   dt*(0:N-1);&lt;br&gt;
&amp;gt; T     =   N*dt&lt;br&gt;
&amp;gt; t      =   0:dt:T-dt;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Fs   =  1/dt&lt;br&gt;
&amp;gt; df    =  1/T&lt;br&gt;
&amp;gt; Fs   =  N*df&lt;br&gt;
&amp;gt; f      =  df*(0:N-1);&lt;br&gt;
&amp;gt; f      =  0:df:Fs-df;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Since the rate of time in the experimental data is known I can control easily what the index of X means: say, from X(1,i) to X(1,i+1) there are 0.11ms while, of course, the first datapoint is t=0.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; You lied. If&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; dt = 1.1e-4&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; % then&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; tmaxsec = (N-1)*dt        % 57.6716 seconds&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; tmaxhr = tmaxsec/3600  % 0.0160 hours (NOT ~ 50)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; did you mean tmax ~ 50 sec ???&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Anyway, go back and recalculate all of the above quantities&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Now, I got: W=fft(X), which is again a vector whose length is 2^19.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; My question is how is the index of this vector W running in the frequency domain? Say, low index means low frequency? frequencies are equally spaced? on what basis?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; See above formula for f&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Also, I would like to know what would I be doing if I fftshift the vector W.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Then the N index periodicity is used to shift all frequences&lt;br&gt;
&amp;gt; at the Nyquist frequency Fs/2 = N*df/2 and above to negative&lt;br&gt;
&amp;gt; frequencies&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; fb = df*(-N/2:N/2-1);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Hope this helps.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Greg</description>
    </item>
  </channel>
</rss>

