Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Help in vectorizing code
Date: Tue, 28 Apr 2009 15:59:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 10
Message-ID: <gt7946$81g$1@fred.mathworks.com>
References: <1e6f5074-edce-417a-b0a5-b62db0fb033f@w31g2000prd.googlegroups.com> <128ed907-11c6-4e7a-a67a-736ececef060@s1g2000prd.googlegroups.com> <gt5sqm$7mc$1@fred.mathworks.com> <gt6dqg$i52$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 1240934342 8240 172.30.248.37 (28 Apr 2009 15:59:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 28 Apr 2009 15:59:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:535984


"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <gt6dqg$i52$1@fred.mathworks.com>...
>  R = poissrnd(lambda,[1,m]); % <- Or your simulated poisson source
>  p = cumsum([1,R]);
>  r = randn(1,p(m+1)-1)+1; % <- Or some other ind. random variables
>  s = [0,cumsum(r)];
>  t = s(p(2:m+1))-s(p(1:m));

  Please remove that +1 from the third line.  To be compatible with my other statements it should not be there.  It had to do with something I was temporarily testing.  The third line should read:

 r = randn(1,p(m+1)-1); % <- Or some other ind. random variables