Convolution of two independent normally distributed random variables

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);

Antworten (3)

Wayne King
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

what we will do if the z = x*y
Does this help ?
http://mathworld.wolfram.com/NormalProductDistribution.html

Melden Sie sich an, um zu kommentieren.

Please try:
mean(x)
std(x)
What does it show? Is it what you expected? Why or why not?
Likewise:
mean(y)
std(y)
Star Strider
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);

Kategorien

Mehr zu Write C Functions Callable from MATLAB (MEX Files) finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 12 Sep. 2012

Kommentiert:

am 7 Mär. 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by