<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/157171</link>
    <title>MATLAB Central Newsreader - Purely real result of IFFT</title>
    <description>Feed for thread: Purely real result of IFFT</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, 04 Oct 2007 16:26:01 -0400</pubDate>
      <title>Purely real result of IFFT</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/157171#395145</link>
      <author>David Doria</author>
      <description>I know that generally if you have a real waveform, the DFT&lt;br&gt;
is complex symmetric (the -f component is the conjugate of&lt;br&gt;
the +f component).&lt;br&gt;
&lt;br&gt;
So to do this backwards (i'm trying to create a random&lt;br&gt;
frequency spectrum that will give a real waveform upon&lt;br&gt;
taking the ifft), I had to write a function like this:&lt;br&gt;
&lt;br&gt;
CN = zeros(1, RandLength);&lt;br&gt;
CN(1 : RandLength/2) = randn(1, RandLength/2) - j*randn(1,&lt;br&gt;
RandLength/2);&lt;br&gt;
CN(RandLength/2 + 1 : RandLength) = conj(CN(RandLength/2 :&lt;br&gt;
-1 : 1));&lt;br&gt;
&lt;br&gt;
However, that didn't work unless i did this:&lt;br&gt;
&lt;br&gt;
%force the element (1) and (N/2 + 1) to be real&lt;br&gt;
CN(1) = randn(1);&lt;br&gt;
CN(RandLength/2 + 1) = randn(1);&lt;br&gt;
&lt;br&gt;
which i found by just seeing what the fft of a small real&lt;br&gt;
vector was (trial and error i guess you could say).&lt;br&gt;
&lt;br&gt;
My question is, why is this not the type of symmetry i am&lt;br&gt;
used to?&lt;br&gt;
&lt;br&gt;
I would expect for a vector of length 6, that&lt;br&gt;
3,4 are conjugates&lt;br&gt;
2,5 are conjugates&lt;br&gt;
1,6 are conjugates&lt;br&gt;
&lt;br&gt;
but instead i need&lt;br&gt;
3,5 are conjugates&lt;br&gt;
2,6 are conjugates&lt;br&gt;
1,4 are real&lt;br&gt;
&lt;br&gt;
This is very very important because before I take the ifft,&lt;br&gt;
i am multiplying with a symmetric, real function, and that&lt;br&gt;
is producing something that is not symmetric!! (so the my&lt;br&gt;
ifft is not purely real)&lt;br&gt;
&lt;br&gt;
Any guidance would be greatly appreciated.&lt;br&gt;
&lt;br&gt;
Thanks,&lt;br&gt;
&lt;br&gt;
David</description>
    </item>
    <item>
      <pubDate>Thu, 04 Oct 2007 16:49:45 -0400</pubDate>
      <title>Re: Purely real result of IFFT</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/157171#395151</link>
      <author>David </author>
      <description>&quot;David Doria&quot; &amp;lt;daviddoria@gmail.com&amp;gt; wrote in message &lt;br&gt;
&amp;lt;fe346p$8no$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I know that generally if you have a real waveform, the &lt;br&gt;
DFT&lt;br&gt;
&amp;gt; is complex symmetric (the -f component is the conjugate &lt;br&gt;
of&lt;br&gt;
&amp;gt; the +f component).&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; So to do this backwards (i'm trying to create a random&lt;br&gt;
&amp;gt; frequency spectrum that will give a real waveform upon&lt;br&gt;
&amp;gt; taking the ifft), I had to write a function like this:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; CN = zeros(1, RandLength);&lt;br&gt;
&amp;gt; CN(1 : RandLength/2) = randn(1, RandLength/2) - j*randn&lt;br&gt;
(1,&lt;br&gt;
&amp;gt; RandLength/2);&lt;br&gt;
&amp;gt; CN(RandLength/2 + 1 : RandLength) = conj(CN&lt;br&gt;
(RandLength/2 :&lt;br&gt;
&amp;gt; -1 : 1));&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; However, that didn't work unless i did this:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; %force the element (1) and (N/2 + 1) to be real&lt;br&gt;
&amp;gt; CN(1) = randn(1);&lt;br&gt;
&amp;gt; CN(RandLength/2 + 1) = randn(1);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; which i found by just seeing what the fft of a small real&lt;br&gt;
&amp;gt; vector was (trial and error i guess you could say).&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; My question is, why is this not the type of symmetry i am&lt;br&gt;
&amp;gt; used to?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I would expect for a vector of length 6, that&lt;br&gt;
&amp;gt; 3,4 are conjugates&lt;br&gt;
&amp;gt; 2,5 are conjugates&lt;br&gt;
&amp;gt; 1,6 are conjugates&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; but instead i need&lt;br&gt;
&amp;gt; 3,5 are conjugates&lt;br&gt;
&amp;gt; 2,6 are conjugates&lt;br&gt;
&amp;gt; 1,4 are real&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; This is very very important because before I take the &lt;br&gt;
ifft,&lt;br&gt;
&amp;gt; i am multiplying with a symmetric, real function, and &lt;br&gt;
that&lt;br&gt;
&amp;gt; is producing something that is not symmetric!! (so the my&lt;br&gt;
&amp;gt; ifft is not purely real)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Any guidance would be greatly appreciated.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; David&lt;br&gt;
&lt;br&gt;
just a quick thought, is this because the base index of &lt;br&gt;
the vector has to be 1 in matlab?  doesn't this offset all &lt;br&gt;
the values by 1 index?  maybe see the doc ifft where it &lt;br&gt;
talks about the conjugate symmetric condition and see if &lt;br&gt;
the +1 in that agrees with what you are seeing.</description>
    </item>
    <item>
      <pubDate>Thu, 04 Oct 2007 17:07:44 -0400</pubDate>
      <title>Re: Purely real result of IFFT</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/157171#395156</link>
      <author>David Doria</author>
      <description>Ok that tells me that I came to the correct conclusion, but&lt;br&gt;
here is a bit further question&lt;br&gt;
&lt;br&gt;
I thought the sum in the IDFT was from  k = -N/2 to N/2, but&lt;br&gt;
here it is from k=0 to N-1&lt;br&gt;
&lt;br&gt;
if you assume that Xk is a complex number (a+bi), and use&lt;br&gt;
Eulers formula to get cos(2*pi*j*k*n/N) + i*sin(2*pi*j*k*n/N)&lt;br&gt;
&lt;br&gt;
you can show that if X(k) = X(-k)* then all the imaginary&lt;br&gt;
terms cancel.  This doesn't work if there are never negative&lt;br&gt;
numbers in the exponent.  How could you show this property&lt;br&gt;
using k = 0 to N-1 ??&lt;br&gt;
&lt;br&gt;
Thanks,&lt;br&gt;
&lt;br&gt;
David&lt;br&gt;
&lt;br&gt;
&quot;David Doria&quot; &amp;lt;daviddoria@gmail.com&amp;gt; wrote in message&lt;br&gt;
&amp;lt;fe346p$8no$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I know that generally if you have a real waveform, the DFT&lt;br&gt;
&amp;gt; is complex symmetric (the -f component is the conjugate of&lt;br&gt;
&amp;gt; the +f component).&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; So to do this backwards (i'm trying to create a random&lt;br&gt;
&amp;gt; frequency spectrum that will give a real waveform upon&lt;br&gt;
&amp;gt; taking the ifft), I had to write a function like this:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; CN = zeros(1, RandLength);&lt;br&gt;
&amp;gt; CN(1 : RandLength/2) = randn(1, RandLength/2) - j*randn(1,&lt;br&gt;
&amp;gt; RandLength/2);&lt;br&gt;
&amp;gt; CN(RandLength/2 + 1 : RandLength) = conj(CN(RandLength/2 :&lt;br&gt;
&amp;gt; -1 : 1));&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; However, that didn't work unless i did this:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; %force the element (1) and (N/2 + 1) to be real&lt;br&gt;
&amp;gt; CN(1) = randn(1);&lt;br&gt;
&amp;gt; CN(RandLength/2 + 1) = randn(1);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; which i found by just seeing what the fft of a small real&lt;br&gt;
&amp;gt; vector was (trial and error i guess you could say).&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; My question is, why is this not the type of symmetry i am&lt;br&gt;
&amp;gt; used to?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I would expect for a vector of length 6, that&lt;br&gt;
&amp;gt; 3,4 are conjugates&lt;br&gt;
&amp;gt; 2,5 are conjugates&lt;br&gt;
&amp;gt; 1,6 are conjugates&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; but instead i need&lt;br&gt;
&amp;gt; 3,5 are conjugates&lt;br&gt;
&amp;gt; 2,6 are conjugates&lt;br&gt;
&amp;gt; 1,4 are real&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; This is very very important because before I take the ifft,&lt;br&gt;
&amp;gt; i am multiplying with a symmetric, real function, and that&lt;br&gt;
&amp;gt; is producing something that is not symmetric!! (so the my&lt;br&gt;
&amp;gt; ifft is not purely real)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Any guidance would be greatly appreciated.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; David</description>
    </item>
    <item>
      <pubDate>Thu, 04 Oct 2007 17:33:51 -0400</pubDate>
      <title>Re: Purely real result of IFFT</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/157171#395158</link>
      <author>David </author>
      <description>&quot;David Doria&quot; &amp;lt;daviddoria@gmail.com&amp;gt; wrote in message &lt;br&gt;
&amp;lt;fe36l0$i5h$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Ok that tells me that I came to the correct conclusion, &lt;br&gt;
but&lt;br&gt;
&amp;gt; here is a bit further question&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I thought the sum in the IDFT was from  k = -N/2 to N/2, &lt;br&gt;
but&lt;br&gt;
&amp;gt; here it is from k=0 to N-1&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; if you assume that Xk is a complex number (a+bi), and use&lt;br&gt;
&amp;gt; Eulers formula to get cos(2*pi*j*k*n/N) + i*sin&lt;br&gt;
(2*pi*j*k*n/N)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; you can show that if X(k) = X(-k)* then all the imaginary&lt;br&gt;
&amp;gt; terms cancel.  This doesn't work if there are never &lt;br&gt;
negative&lt;br&gt;
&amp;gt; numbers in the exponent.  How could you show this &lt;br&gt;
property&lt;br&gt;
&amp;gt; using k = 0 to N-1 ??&lt;br&gt;
&lt;br&gt;
i am probably not the best one to explain this, but take a &lt;br&gt;
good look at the fftshift function and the indexing they &lt;br&gt;
explain in the description of the fft function itself in &lt;br&gt;
the help.  i rarely have use for ifft and usually only &lt;br&gt;
worry about psd... but i think what you would expect to be &lt;br&gt;
the -N/2 to 0 part is actually the high end of the vector, &lt;br&gt;
the fftshift function moves it around so the '0' index (DC &lt;br&gt;
component) is in the middle of the result vector, which is &lt;br&gt;
easier for some people to handle... then you just have to &lt;br&gt;
subtract N/2 from each index to line up the indexing with &lt;br&gt;
the classical formulas.  again, this is all because matlab &lt;br&gt;
indexes have to be integers &amp;gt;0... so everything is shifted &lt;br&gt;
to accomodate this limitation.</description>
    </item>
    <item>
      <pubDate>Thu, 04 Oct 2007 17:54:05 -0400</pubDate>
      <title>Re: Purely real result of IFFT</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/157171#395161</link>
      <author>Steve Eddins</author>
      <description>David Doria wrote:&lt;br&gt;
&amp;gt; I know that generally if you have a real waveform, the DFT&lt;br&gt;
&amp;gt; is complex symmetric (the -f component is the conjugate of&lt;br&gt;
&amp;gt; the +f component).&lt;br&gt;
&lt;br&gt;
I would say that the discrete-time Fourier transform (DTFT) is conjugate &lt;br&gt;
symmetric such that X(f) = conj(X(-f)).  The discrete Fourier transform &lt;br&gt;
(DFT) is defined over a discrete sample index from 0 to N-1, so the &lt;br&gt;
symmetry property is similar but not exactly the same.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;gt; I would expect for a vector of length 6, that&lt;br&gt;
&amp;nbsp;&amp;gt; 3,4 are conjugates&lt;br&gt;
&amp;nbsp;&amp;gt; 2,5 are conjugates&lt;br&gt;
&amp;nbsp;&amp;gt; 1,6 are conjugates&lt;br&gt;
&amp;nbsp;&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;gt; but instead i need&lt;br&gt;
&amp;nbsp;&amp;gt; 3,5 are conjugates&lt;br&gt;
&amp;nbsp;&amp;gt; 2,6 are conjugates&lt;br&gt;
&amp;nbsp;&amp;gt; 1,4 are real&lt;br&gt;
&lt;br&gt;
That's not quite correct.&lt;br&gt;
&lt;br&gt;
Suppose you have this DFT transform pair:&lt;br&gt;
&lt;br&gt;
x[n], 0 &amp;lt;= n &amp;lt;= N-1&lt;br&gt;
X[k], 0 &amp;lt;= k &amp;lt;= N-1&lt;br&gt;
&lt;br&gt;
If x[n] is real, then X[k] satisfies this symmetry relationship:&lt;br&gt;
&lt;br&gt;
X[k] = conj(X[mod(N-k,N)])&lt;br&gt;
&lt;br&gt;
Note that this symmetry relationship implies that X[0] must be real, &lt;br&gt;
because X[0] = conj(X[mod(N,N)]) = conj(X[0]).&lt;br&gt;
&lt;br&gt;
If N is even, it also implies that X[N/2] is real, because X[N/2] = &lt;br&gt;
conj(X[mod(N - N/2,N)]) = conj(X[mod(N/2,N)]) = conj(X[N/2]).&lt;br&gt;
&lt;br&gt;
If we switch to 1-based vector indexing, then the conjugate symmetry &lt;br&gt;
relationship becomes:&lt;br&gt;
&lt;br&gt;
X(k) = conj(X(mod(N-k+1,N)+1)), 1 &amp;lt;= k &amp;lt;= N.&lt;br&gt;
&lt;br&gt;
&amp;gt; This is very very important because before I take the ifft,&lt;br&gt;
&amp;gt; i am multiplying with a symmetric, real function, and that&lt;br&gt;
&amp;gt; is producing something that is not symmetric!! (so the my&lt;br&gt;
&amp;gt; ifft is not purely real)&lt;br&gt;
&lt;br&gt;
The function you are multiplying with needs to satisfy the symmetry &lt;br&gt;
condition I described above.&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
Steve Eddins&lt;br&gt;
&lt;a href=&quot;http://blogs.mathworks.com/steve&quot;&gt;http://blogs.mathworks.com/steve&lt;/a&gt;</description>
    </item>
    <item>
      <pubDate>Thu, 04 Oct 2007 17:54:17 -0400</pubDate>
      <title>Re: Purely real result of IFFT</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/157171#395162</link>
      <author>David Doria</author>
      <description>I looked at that... it still seems to give a very weird result.&lt;br&gt;
&lt;br&gt;
If i take a=[1 2 3 4 5 6]&lt;br&gt;
&lt;br&gt;
b=fft(a) is in the strange form (not symmetric over the 3/4&lt;br&gt;
break)&lt;br&gt;
&lt;br&gt;
fftshift(b) is actually just as not symmetric, simply the 2&lt;br&gt;
halves switched.&lt;br&gt;
&lt;br&gt;
Any more ideas?&lt;br&gt;
&lt;br&gt;
David&lt;br&gt;
&lt;br&gt;
&quot;David &quot; &amp;lt;dave@bigcompany.com&amp;gt; wrote in message&lt;br&gt;
&amp;lt;fe385v$coq$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;David Doria&quot; &amp;lt;daviddoria@gmail.com&amp;gt; wrote in message &lt;br&gt;
&amp;gt; &amp;lt;fe36l0$i5h$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; Ok that tells me that I came to the correct conclusion, &lt;br&gt;
&amp;gt; but&lt;br&gt;
&amp;gt; &amp;gt; here is a bit further question&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; I thought the sum in the IDFT was from  k = -N/2 to N/2, &lt;br&gt;
&amp;gt; but&lt;br&gt;
&amp;gt; &amp;gt; here it is from k=0 to N-1&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; if you assume that Xk is a complex number (a+bi), and use&lt;br&gt;
&amp;gt; &amp;gt; Eulers formula to get cos(2*pi*j*k*n/N) + i*sin&lt;br&gt;
&amp;gt; (2*pi*j*k*n/N)&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; you can show that if X(k) = X(-k)* then all the imaginary&lt;br&gt;
&amp;gt; &amp;gt; terms cancel.  This doesn't work if there are never &lt;br&gt;
&amp;gt; negative&lt;br&gt;
&amp;gt; &amp;gt; numbers in the exponent.  How could you show this &lt;br&gt;
&amp;gt; property&lt;br&gt;
&amp;gt; &amp;gt; using k = 0 to N-1 ??&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; i am probably not the best one to explain this, but take a &lt;br&gt;
&amp;gt; good look at the fftshift function and the indexing they &lt;br&gt;
&amp;gt; explain in the description of the fft function itself in &lt;br&gt;
&amp;gt; the help.  i rarely have use for ifft and usually only &lt;br&gt;
&amp;gt; worry about psd... but i think what you would expect to be &lt;br&gt;
&amp;gt; the -N/2 to 0 part is actually the high end of the vector, &lt;br&gt;
&amp;gt; the fftshift function moves it around so the '0' index (DC &lt;br&gt;
&amp;gt; component) is in the middle of the result vector, which is &lt;br&gt;
&amp;gt; easier for some people to handle... then you just have to &lt;br&gt;
&amp;gt; subtract N/2 from each index to line up the indexing with &lt;br&gt;
&amp;gt; the classical formulas.  again, this is all because matlab &lt;br&gt;
&amp;gt; indexes have to be integers &amp;gt;0... so everything is shifted &lt;br&gt;
&amp;gt; to accomodate this limitation.&lt;br&gt;
&amp;gt; </description>
    </item>
    <item>
      <pubDate>Thu, 04 Oct 2007 19:36:34 -0400</pubDate>
      <title>Re: Purely real result of IFFT</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/157171#395172</link>
      <author>David Doria</author>
      <description>So does anyone know how to show that the IFFT of a complex&lt;br&gt;
symmetric function is purely real when you use the k=0 to&lt;br&gt;
N-1 definition? My current method completely relies on the&lt;br&gt;
exponent of the exponential switching signs, which it in&lt;br&gt;
fact does not do here... Does it now happen because sine and&lt;br&gt;
cosine of integer multiples of 2*pi have opposite signs than&lt;br&gt;
odd multiples of pi ?&lt;br&gt;
&lt;br&gt;
Thanks,&lt;br&gt;
&lt;br&gt;
David&lt;br&gt;
&lt;br&gt;
&quot;David Doria&quot; &amp;lt;daviddoria@gmail.com&amp;gt; wrote in message&lt;br&gt;
&amp;lt;fe39c9$1p3$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I looked at that... it still seems to give a very weird&lt;br&gt;
result.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; If i take a=[1 2 3 4 5 6]&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; b=fft(a) is in the strange form (not symmetric over the 3/4&lt;br&gt;
&amp;gt; break)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; fftshift(b) is actually just as not symmetric, simply the 2&lt;br&gt;
&amp;gt; halves switched.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Any more ideas?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; David&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &quot;David &quot; &amp;lt;dave@bigcompany.com&amp;gt; wrote in message&lt;br&gt;
&amp;gt; &amp;lt;fe385v$coq$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &quot;David Doria&quot; &amp;lt;daviddoria@gmail.com&amp;gt; wrote in message &lt;br&gt;
&amp;gt; &amp;gt; &amp;lt;fe36l0$i5h$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Ok that tells me that I came to the correct conclusion, &lt;br&gt;
&amp;gt; &amp;gt; but&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; here is a bit further question&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; I thought the sum in the IDFT was from  k = -N/2 to N/2, &lt;br&gt;
&amp;gt; &amp;gt; but&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; here it is from k=0 to N-1&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; if you assume that Xk is a complex number (a+bi), and use&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Eulers formula to get cos(2*pi*j*k*n/N) + i*sin&lt;br&gt;
&amp;gt; &amp;gt; (2*pi*j*k*n/N)&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; you can show that if X(k) = X(-k)* then all the imaginary&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; terms cancel.  This doesn't work if there are never &lt;br&gt;
&amp;gt; &amp;gt; negative&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; numbers in the exponent.  How could you show this &lt;br&gt;
&amp;gt; &amp;gt; property&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; using k = 0 to N-1 ??&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; i am probably not the best one to explain this, but take a &lt;br&gt;
&amp;gt; &amp;gt; good look at the fftshift function and the indexing they &lt;br&gt;
&amp;gt; &amp;gt; explain in the description of the fft function itself in &lt;br&gt;
&amp;gt; &amp;gt; the help.  i rarely have use for ifft and usually only &lt;br&gt;
&amp;gt; &amp;gt; worry about psd... but i think what you would expect to be &lt;br&gt;
&amp;gt; &amp;gt; the -N/2 to 0 part is actually the high end of the vector, &lt;br&gt;
&amp;gt; &amp;gt; the fftshift function moves it around so the '0' index (DC &lt;br&gt;
&amp;gt; &amp;gt; component) is in the middle of the result vector, which is &lt;br&gt;
&amp;gt; &amp;gt; easier for some people to handle... then you just have to &lt;br&gt;
&amp;gt; &amp;gt; subtract N/2 from each index to line up the indexing with &lt;br&gt;
&amp;gt; &amp;gt; the classical formulas.  again, this is all because matlab &lt;br&gt;
&amp;gt; &amp;gt; indexes have to be integers &amp;gt;0... so everything is shifted &lt;br&gt;
&amp;gt; &amp;gt; to accomodate this limitation.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; </description>
    </item>
    <item>
      <pubDate>Thu, 04 Oct 2007 21:13:49 -0400</pubDate>
      <title>Re: Purely real result of IFFT</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/157171#395177</link>
      <author> dbd</author>
      <description>On Oct 4, 9:26 am, &quot;David Doria&quot; &amp;lt;daviddo...@gmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; I know that generally if you have a real waveform, the DFT&lt;br&gt;
&amp;gt; is complex symmetric (the -f component is the conjugate of&lt;br&gt;
&amp;gt; the +f component).&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; So to do this backwards (i'm trying to create a random&lt;br&gt;
&amp;gt; frequency spectrum that will give a real waveform upon&lt;br&gt;
&amp;gt; taking the ifft), I had to write a function like this:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; CN = zeros(1, RandLength);&lt;br&gt;
&amp;gt; CN(1 : RandLength/2) = randn(1, RandLength/2) - j*randn(1,&lt;br&gt;
&amp;gt; RandLength/2);&lt;br&gt;
&amp;gt; CN(RandLength/2 + 1 : RandLength) = conj(CN(RandLength/2 :&lt;br&gt;
&amp;gt; -1 : 1));&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; However, that didn't work unless i did this:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; %force the element (1) and (N/2 + 1) to be real&lt;br&gt;
&amp;gt; CN(1) = randn(1);&lt;br&gt;
&amp;gt; CN(RandLength/2 + 1) = randn(1);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; which i found by just seeing what the fft of a small real&lt;br&gt;
&amp;gt; vector was (trial and error i guess you could say).&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; My question is, why is this not the type of symmetry i am&lt;br&gt;
&amp;gt; used to?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I would expect for a vector of length 6, that&lt;br&gt;
&amp;gt; 3,4 are conjugates&lt;br&gt;
&amp;gt; 2,5 are conjugates&lt;br&gt;
&amp;gt; 1,6 are conjugates&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; but instead i need&lt;br&gt;
&amp;gt; 3,5 are conjugates&lt;br&gt;
&amp;gt; 2,6 are conjugates&lt;br&gt;
&amp;gt; 1,4 are real&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; This is very very important because before I take the ifft,&lt;br&gt;
&amp;gt; i am multiplying with a symmetric, real function, and that&lt;br&gt;
&amp;gt; is producing something that is not symmetric!! (so the my&lt;br&gt;
&amp;gt; ifft is not purely real)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Any guidance would be greatly appreciated.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Thanks,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; David&lt;br&gt;
&lt;br&gt;
The issue here is a common difficulty in translating the sense of&lt;br&gt;
symmetry from the continuous domain to the discrete domain. The topic&lt;br&gt;
has a long history. The classic Harris windows paper discusses it and&lt;br&gt;
uses the term &quot;DFT-even&quot; for the result.&lt;br&gt;
&lt;br&gt;
The paper is available at:&lt;br&gt;
&lt;a href=&quot;http://www.eng.vt.edu/me5714/textbook/windows.pdf&quot;&gt;http://www.eng.vt.edu/me5714/textbook/windows.pdf&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
The topic is explained on the first and second pages of the paper.&lt;br&gt;
&lt;br&gt;
Dale B. Dalrymple&lt;br&gt;
&lt;a href=&quot;http://dbdimages.com&quot;&gt;http://dbdimages.com&lt;/a&gt;&lt;br&gt;
&lt;a href=&quot;http://stores.lulu.com/dbd&quot;&gt;http://stores.lulu.com/dbd&lt;/a&gt;</description>
    </item>
  </channel>
</rss>

