Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Purely real result of IFFT
Date: Thu, 4 Oct 2007 16:49:45 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 60
Message-ID: <fe35j9$v5$1@fred.mathworks.com>
References: <fe346p$8no$1@fred.mathworks.com>
Reply-To: <HIDDEN>
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 1191516585 997 172.30.248.38 (4 Oct 2007 16:49:45 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 4 Oct 2007 16:49:45 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 791003
Xref: news.mathworks.com comp.soft-sys.matlab:431374



"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

just a quick thought, is this because the base index of 
the vector has to be 1 in matlab?  doesn't this offset all 
the values by 1 index?  maybe see the doc ifft where it 
talks about the conjugate symmetric condition and see if 
the +1 in that agrees with what you are seeing.