Path: news.mathworks.com!not-for-mail
From: "David Doria" <daviddoria@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Purely real result of IFFT
Date: Thu, 4 Oct 2007 17:07:44 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 67
Message-ID: <fe36l0$i5h$1@fred.mathworks.com>
References: <fe346p$8no$1@fred.mathworks.com>
Reply-To: "David Doria" <daviddoria@gmail.com>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1191517664 18609 172.30.248.38 (4 Oct 2007 17:07:44 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 4 Oct 2007 17:07:44 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1105197
Xref: news.mathworks.com comp.soft-sys.matlab:431379



Ok that tells me that I came to the correct conclusion, but
here is a bit further question

I thought the sum in the IDFT was from  k = -N/2 to N/2, but
here it is from k=0 to N-1

if you assume that Xk is a complex number (a+bi), and use
Eulers formula to get cos(2*pi*j*k*n/N) + i*sin(2*pi*j*k*n/N)

you can show that if X(k) = X(-k)* then all the imaginary
terms cancel.  This doesn't work if there are never negative
numbers in the exponent.  How could you show this property
using k = 0 to N-1 ??

Thanks,

David

"David Doria" <daviddoria@gmail.com> wrote in message
<fe346p$8no$1@fred.mathworks.com>...
> I know that generally if you have a real waveform, the DFT
> is complex symmetric (the -f component is the conjugate of
> the +f component).
> 
> So to do this backwards (i'm trying to create a random
> frequency spectrum that will give a real waveform upon
> taking the ifft), I had to write a function like this:
> 
> CN = zeros(1, RandLength);
> CN(1 : RandLength/2) = randn(1, RandLength/2) - j*randn(1,
> RandLength/2);
> CN(RandLength/2 + 1 : RandLength) = conj(CN(RandLength/2 :
> -1 : 1));
> 
> However, that didn't work unless i did this:
> 
> %force the element (1) and (N/2 + 1) to be real
> CN(1) = randn(1);
> CN(RandLength/2 + 1) = randn(1);
> 
> which i found by just seeing what the fft of a small real
> vector was (trial and error i guess you could say).
> 
> My question is, why is this not the type of symmetry i am
> used to?
> 
> I would expect for a vector of length 6, that
> 3,4 are conjugates
> 2,5 are conjugates
> 1,6 are conjugates
> 
> but instead i need
> 3,5 are conjugates
> 2,6 are conjugates
> 1,4 are real
> 
> This is very very important because before I take the ifft,
> i am multiplying with a symmetric, real function, and that
> is producing something that is not symmetric!! (so the my
> ifft is not purely real)
> 
> Any guidance would be greatly appreciated.
> 
> Thanks,
> 
> David