Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How can I find the mean between to points of normal distribution?
Date: Mon, 2 Aug 2010 22:39:04 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 18
Message-ID: <i37he8$cmp$1@fred.mathworks.com>
References: <i371ts$ht3$1@fred.mathworks.com> <i37711$fqu$1@fred.mathworks.com> <i37ctu$1ta$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1280788744 13017 172.30.248.37 (2 Aug 2010 22:39:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 2 Aug 2010 22:39:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:658457

"BobC Cadenza" <bobc@mailinator.com> wrote in message <i37ctu$1ta$1@fred.mathworks.com>...
> Thanks Roger, that works perfectly.  Since that worked so nice, how about adding in a wrinkle.   How would I include in the mean the values, that are outside a and b limited to a and b.  For example p(x<a)=p(a) and p(x>b)=p(b)
- - - - - - - - - - -
  Well that alters the assumption I was making.  When you write

 int(x*p(x),'x',a,b)/int(p(x),'x',a,b)

as I did, that implies that the probability P2(a<=x & x<=b) is one, so that P2(x<a) and P2(x>b) are therefore each equal to zero (where P2 means the revised probability.)  In other words, by that former assumption x can't be outside [a,b].

  It sounds to me as though you are now saying that the probability density between a and b is to remain that same as in the original normal density, but that all x's below a are now to be concentrated in the single point x=a and similarly for x>b at the point x=b.  In that case there is no normalization to be done.  The mean would be the straightforward expression:

 int(a*p(x),'x',-inf,a) + int(x*p(x),'x',a,b) + int(b*p(x),'x',b,inf)

where again p(x) is the original pdf for mu and sigma.  The first and last of these integrals just involves the cdf for p(x).  The middle term is evaluated by the same trick I described earlier.

  I hope I have understood correctly what you are asking.

Roger Stafford