Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: for loop - variable increment
Date: Wed, 11 Jun 2008 18:00:19 +0000 (UTC)
Organization: Universit&#228;tsSpital Z&#252;rich
Lines: 35
Message-ID: <g2p3rj$9m4$1@fred.mathworks.com>
References: <g2p1ca$8sa$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1213207219 9924 172.30.248.35 (11 Jun 2008 18:00:19 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 11 Jun 2008 18:00:19 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 11
Xref: news.mathworks.com comp.soft-sys.matlab:473341



"Mario ":
<SNIP out of the loop...

> for i=0.0001:i:1
>    test(i)
> end
> so the first call would be test(0.0001), the second one 
test(0.0002), the third one test(0.0004), then test(0.0008) 
and so on...

one of the many solutions

     inc=.0001;
     v=inc*2.^(0:-log2(inc));
for  i=v
     disp(i);
end
%{
     0.0001
     0.0002
     0.0004
     0.0008
     0.0016
     0.0032
     0.0064
     0.0128
     0.0256
     0.0512
     0.1024
     0.2048
     0.4096
     0.8192
%}

us