Convolution of two independent normally distributed random variables
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
If x and y are independent and both normal with mean=5, and v=4, then z=x+y should be normal with mean=10, and v=8. Why can't I proof this using convolution in Matlab.
a=linspace(-5,15,10000); x=normpdf(a,5,2); y=normpdf(a,5,2); z=conv(x,y); m=mean(z); sd=std(z);
0 Kommentare
Antworten (3)
Wayne King
am 14 Sep. 2012
Bearbeitet: Wayne King
am 14 Sep. 2012
Hi, you are confusing things here a bit. You don't want to consider the mean and standard deviations of the PDFs. You want to consider the mean and standard deviation of the random variables. Those are very different things.
x = normrnd(5,2,1000,1);
y = normrnd(5,2,1000,1);
z = x+y;
mean(z), var(z)
To see that the N(0,8) (here I mean variance 8) is good fit to z
x = normrnd(5,2,1000,1);
y = normrnd(5,2,1000,1);
z = x+y;
mu = 10;
sigma = sqrt(8);
zmin = min(z); zmax = max(z); zrange = range(z);
binw = zrange / 30;
edges = zmin + binw*(0:30);
n = histc(z, edges);
bar(edges, n, 'histc');
hold on
xx = zmin:(zrange/1000):zmax;
plot(xx, binw*length(z)*normpdf(xx,mu,sigma), 'r');
title('Normal Fit');
The PDF of z is the convolution of the PDFs of x and y
2 Kommentare
Rick Rosson
am 14 Sep. 2012
Please try:
mean(x)
std(x)
What does it show? Is it what you expected? Why or why not?
Likewise:
mean(y)
std(y)
0 Kommentare
Star Strider
am 14 Sep. 2012
Bearbeitet: Star Strider
am 14 Sep. 2012
Since the convolution is based on the variables described by a specific distribution, it's likely best to look at the inverse normal distribution:
p = linspace(0.001,0.999,10000);
x = norminv(p,5,2);
y = norminv(p,5,2);
These give the values of a mean of 5 and a standard deviation of 2:
mx = mean(x);
sx = std(x);
my = mean(y);
sy = std(y);
and these give the values of a mean of 10 and standard deviation of 4:
z = x + y;
mz = mean(z);
sz = std(z);
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!