Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Plot area under two intersecting normal curves
Date: Thu, 25 Apr 2013 21:36:07 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 33
Message-ID: <klc7k7$4gc$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-00-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1366925767 4620 172.30.248.45 (25 Apr 2013 21:36:07 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 25 Apr 2013 21:36:07 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 4174257
Xref: news.mathworks.com comp.soft-sys.matlab:794368

Hi,
I am VERY out of practice with MATLAB! I am hoping what I am trying to do is not that complicated - any help would be greatly appreciated!
I have scoured documentation, forums etc and though I am sure the answer is out there I am not understanding it.

I have plotted two Gaussian curves on the same figure. These are both the result of a normpdf() on the same range but different mean and std 

I get two lovely curves intersecting slightly.
Now I "just" need to calculate the area of intersection.....and this is what is going very wrong!

The code up to the point of plotting the curves is:
mx256m = [-17747.998047,-17859.041016,-17474.904297,-16872.554688,-18829.910156,-19107.115234,-17471.216797,-19600.185547,-18658.857422,-17313.257812]; 
imp = [-43974.179688,-28197.365234,-48259.617188,-35682.351562,-38330.378906,-29280.316406,-23040.587891,-22871.777344];

figure('Color',[1 1 1]);
x = -50000:0.1: -14000;

mu256=mean(mx256m);
sigma256=std(mx256m);
Y256pdf=normpdf(x,mu256,sigma256);
plot(x,Y256pdf,'r','LineWidth',2);
hold;


muimp=mean(imp);
sigmaimp=std(imp);
Yimppdf=normpdf(x,muimp,sigmaimp);
plot(x,Yimppdf,'-g','LineWidth',2);


I have looked at trapz() and quad() . I have tried trapz(Yimppdf) etc but the figures I am getting are nonesense.
I am very confused by the onlie docs for these functions. Can anyone tell me how I use them in for the curves I have plotted above and more specifically to get teh intersecting area???

Thank you for your time and ideas!