Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Improving scaling algorithum
Date: Wed, 24 Nov 2010 20:56:03 +0000 (UTC)
Organization: UNQ
Lines: 17
Message-ID: <icju52$lub$1@fred.mathworks.com>
References: <icgdj8$gh8$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1290632163 22475 172.30.248.35 (24 Nov 2010 20:56:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 24 Nov 2010 20:56:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 260585
Xref: news.mathworks.com comp.soft-sys.matlab:689790

may be:


clear all,clc
D=randn(1000)*10
state=1
count=0;
while state& count<1e2
    pos=D<-pi;
    D(pos)=D(pos)+2*pi;
    state=sum(pos(:))
    pos=D>pi;
    D(pos)=D(pos)-2*pi;
    state=state+sum(pos(:))
    count=count+1;
end
count