Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Monte Carlo Simulation Problem
Date: Wed, 22 Jul 2009 18:04:02 +0000 (UTC)
Organization: University of Nottingham
Lines: 6
Message-ID: <h47kai$db7$1@fred.mathworks.com>
References: <h450sj$t4m$1@fred.mathworks.com> <h45bp9$hr6$1@fred.mathworks.com> <h45pnj$rlt$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 1248285842 13671 172.30.248.35 (22 Jul 2009 18:04:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 22 Jul 2009 18:04:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1072079
Xref: news.mathworks.com comp.soft-sys.matlab:557636

"Tony WANG" <tonywang86@gmail.com> wrote in message <h45pnj$rlt$1@fred.mathworks.com>...
> Thanks a lot, Simon. I think that's the answer I wanted.

Actually, on second reading it's not exactly right.  The code is correct if you define Y to be I(X<=4.2) where I is the indicator function. Then mean(Y) = Pr(X<=4.2).  (But in the way you  define Y in the OP it is not a random variable)

Hope that helps, S