Path: news.mathworks.com!not-for-mail
From: "David Doria" <daviddoria@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Purely real result of IFFT
Date: Thu, 4 Oct 2007 16:26:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 46
Message-ID: <fe346p$8no$1@fred.mathworks.com>
Reply-To: "David Doria" <daviddoria@gmail.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1191515161 8952 172.30.248.37 (4 Oct 2007 16:26:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 4 Oct 2007 16:26:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1105197
Xref: news.mathworks.com comp.soft-sys.matlab:431368



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