Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Ifft on modified array fails
Date: Sun, 8 Nov 2009 16:27:01 +0000 (UTC)
Organization: Xoran Technologies
Lines: 35
Message-ID: <hd6rgl$kgj$1@fred.mathworks.com>
References: <hd1tr4$9lk$1@fred.mathworks.com> <hd23bt$l4f$1@fred.mathworks.com> <hd2rdu$l9g$1@fred.mathworks.com> <hd42o1$re2$1@fred.mathworks.com> <hd45ph$3ij$1@fred.mathworks.com> <hd5upv$nr4$1@fred.mathworks.com>
Reply-To: <HIDDEN>
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 1257697621 21011 172.30.248.37 (8 Nov 2009 16:27:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 8 Nov 2009 16:27:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440443
Xref: news.mathworks.com comp.soft-sys.matlab:583362


"Travis Bland" <travisbland88@yahoo.com> wrote in message <hd5upv$nr4$1@fred.mathworks.com>...
> "Matt " <xys@whatever.com> wrote in message <hd45ph$3ij$1@fred.mathworks.com>...
> > "Matt " <xys@whatever.com> wrote in message <hd42o1$re2$1@fred.mathworks.com>...
> > 
> > > The important thing to remember is that, for a given index k, if you set 
> > > freq100(k)=0, then you must also set 
> > > freq100(N+1-k)=0 to preserve conjugate symmetry of the spectrum. 
> > 
> > Make that freq100(N+2-k)=0
> 
> Well i could be mistaken but i think that's what i'm doing, i just do it in the second for loop. The plot is reflected at 1000mhz, when i run the code and remove   0-100mhz, 1900-2000mhz is also removed... so it stays symmetric, visually at least.
===============

Well, visual tests can be misleading when the discrepancies are too small to show up noticably in a plot.  

One clue here that something is wrong is that the number of steps in your first for-loop is high_bins, while the 2nd for-loop runs over 
high_bins-low_bins+1 elements. So, the two loops are just not going to even be of the same length (let alone be symmetric) unless low_bins=1. If low_bins is equal to 1 all the time, I don't know why you would have it in there as a variable.

It occurs to me that maybe you want your first for-loop to start from low_bins instead of from 1, e.g.

for i = low_bin:high_bin;
    freq100(i) = 0;
end

If so, you still need to make sure the 2nd for-loop uses the N+2-k rule, so it should be

range=low_bin:high_bin;

range(range==1)=[];  %No need to include DC

symrange=N+2-range; %The symmetric counterpart using the N+2-k rule

for p = symrange
    freq100(p) = 0;
end