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 20:30:05 +0000 (UTC)
Organization: Xoran Technologies
Lines: 27
Message-ID: <hd79oc$i8r$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> <hd6rgl$kgj$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 1257712205 18715 172.30.248.37 (8 Nov 2009 20:30:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 8 Nov 2009 20:30:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440443
Xref: news.mathworks.com comp.soft-sys.matlab:583405


"Matt " <xys@whatever.com> wrote in message <hd6rgl$kgj$1@fred.mathworks.com>...

> 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 

Also, you would really do well to get acquainted with MATLAB's vector indexing operations and get rid of these for loops:

%For-loop Free !!!!

range=low_bin:high_bin;
symrange=N+2-range(range~=1);

freq100(range)=0;  
freq100(symrange)=0;