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$>
References: <h450sj$t4m$> <h45bp9$hr6$> <h45pnj$rlt$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: 1248285842 13671 (22 Jul 2009 18:04:02 GMT)
NNTP-Posting-Date: Wed, 22 Jul 2009 18:04:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1072079
Xref: comp.soft-sys.matlab:557636

"Tony WANG" <> wrote in message <h45pnj$rlt$>...
> 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