How to calculate the Product between Gaussian and exponential distribution in Matlab?

40 visualizzazioni (ultimi 30 giorni)
My work
clamp force = (force of the wheel * friction coefficient)
where
the force of the wheel is Gaussian distributed and friction of the coefficient is exponentially distributed.
The result would give another type of distribution
It looks like Gauss distribution * exponential distribution. Both are independent.
I know it will go with convolution, But how we will apply this formula in Matlab.
Gauss Distribution
PDF1 = gauss distribution
where mu = 1500; sigma = 50; and range from 50 to 3000;
Exponential distribution
PDF2 = exponential distrinbution
where
lemda = 23; and range from 0 to 30;
distribution of clamp force = ?

Risposta accettata

John D'Errico
John D'Errico il 6 Mar 2019
Modificato: John D'Errico il 6 Mar 2019
Let me answer this, because I think you are asking the wrong question.
Assume that you have two random variables, one normal (call it W, for wheel) and one exponential (call it f, for friction.)
You want to compute the product of those random variables, then to know what the distribution of the product would be. Much of the time, that task is impossible to anser exactly. Thus, given some genral nonlinear function of multiple random variables, what is the distribution of some general function f(X,Y,...).
Sometimes, it is trivially easy. For example,the sum of any number of normal (Gaussian) ditributions is also Normally distributed. it is even easy to compute the mean and variance of the resulting Normal sum. Great. But the problem is, we get spoiled. And in fact, most nonlinear functional transformations of distributions are not so easily dealt with. The general field that deals with these questions is sometimes called Statistical Tolerancing, also Tolerance Analysis.
Mathematically, one can indeed write the desired distribution as sort of a convolution integral, involving the the corresponding PDFs. But the problem is, it won't usually be anything useful. There simply are not that many distributions out there that will represent the distribution of any general function of any set of random variables.
In the case of the desired product distribution, you can find it here
On that page, you will find the distribution shown as an integral.
Pz(x) = int(Px(x) * Py(z/x) *1/abs(x),[-inf,inf])
Since one of the distributions is an exponential, assume that is x. So we need only integrate from 0 to inf. We would then have
Px(x) = lambda*exp(-lambda*x)
And
Py(y) = 1/(sigma*sqrt(2*pi))*exp(-(y - mu)^2/(2*sigma^2))
But sadly, it does not appear the result is anything very usful. I'm not even positive the integral will have an analytical solution. But, just for kicks, lets see what the symbolic toolbox can do with the product of a standard exponential and a standard normal from that expression. So we would have
lambda = 1
sigma = 1
mu = 0
The integral would be written as:
syms x z
int(exp(-x)*1/sqrt(2*pi)*exp(-(z/x)^2/2)/x,x,[0,inf])
ans =
piecewise(angle(1/z^2) in Dom::Interval([-pi/2], [pi/2]), (1125899906842624*meijerG([1/2, 1, 1], [], [], [], 8/z^2))/(5644425081792261*pi^(1/2)), ~angle(1/z^2) in Dom::Interval([-pi/2], [pi/2]), int((2251799813685248*exp(-x)*exp(-z^2/(2*x^2)))/(5644425081792261*x), x, 0, Inf))
So, way less interesting that we want.
In practice, one uses other methods to approximate the desired distribution. First though, can we recognize the distribution? For example, is the product also normally distributed?
x = exprnd(1,1,1e8);
y = randn(1,1e8);
mean(x.*y)
ans =
-0.00017924
var(x.*y)
ans =
2.0007
skewness(x.*y)
ans =
-0.0017322
kurtosis(x.*y)
ans =
18.055
Hmm. I'd expect the odd moments to approch zero for large sample sizes. Ans 1e8 is quite large as sample sizes go.
It looks like the variance of the product seem to approach 2. The problem is the 4th moment. A normal has a Kurtosis of 3. That means the product distribution is not normally distributed, with differently shaped tails compared to a Normal distribution. We can see that from a histogram.
hist(x.*y,1000)
What distribution is this?
[r,type] = pearsrnd(0,sqrt(2),0,18,0,0)
r =
[]
type =
7
Which pearsrnd tells us seems to approximately a Student-t, as close as it can come. Not exactly, but a Student's t would be close.
Type 7: Student's t location-scale
Now, lets try it. I'll use a smaller sample size to not get the distribution fitter too upset.
x = exprnd(1,1,1e6);
y = randn(1,1e6);
z = (x.*y)';
D = fitdist(z,'tlocationscale')
D =
tLocationScaleDistribution
t Location-Scale distribution
mu = 0.000146401 [-0.000891219, 0.00118402]
sigma = 0.407176 [0.40559, 0.408768]
nu = 1.22331 [1.21773, 1.22891]
histogram(z',100,'normalization','pdf')
hold on
fplot(@D.pdf)
The t actually looks alright. Not perfect. But decent.
As we saw above, IF this were a Student's t, then we could back out a degrees of freedom. I.e., if the variance is 2 then the corresponding degrees of freedom would be nu/(nu-2). Solving for nu, we get 4 effective degrees of freedom. But a t with 4 degrees of freedom has a Kurtosis of inf.
Oh well, the point of all this is you won't get an exact pdf out of this product of an exponential and a Gaussian, but it looks as if you will do alright if you treat it as a Student's t.
  5 Commenti
Deepak Kumar
Deepak Kumar il 12 Mar 2019
I applied with this normal formula for division in Matlab
U/V = U./V, and the result looks like a good, but I have no more confidence with my result.
John D'Errico
John D'Errico il 17 Mar 2019
The ratio of two normal random variables is a Cauchy distribution as I recall. It has all sorts of nasty problems. You probably don't really want to go there.

Accedi per commentare.

Più risposte (1)

Jeff Miller
Jeff Miller il 6 Mar 2019
You might find Cupid useful for this. You could set up the clampforce random variable like this:
wheelforce=TruncatedX(Normal(1500,50),50,3000);
friction=TruncatedX(Exponential(0.23),eps,30); % Cupid's "Product" does not allow zero values, so use a lower bound of eps.
clampforce = Product(wheelforce,friction);
clampforce.UseSplinePDFOn(1000); % Optional, but using a spline approximation speeds up all computations in this case.
Now you can find out about the clampforce random variable with obvious commands:
clampforce.Mean
ans =
6479.2
clampforce.SD
ans =
6370.6
clampforce.CDF(500)
ans =
0.0015147
clampforce.PlotDens; % Plot the PDF and CDF
r = clampforce.Random(100,1); % generate random numbers from the distribution
% and so on...

Community Treasure Hunt

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

Start Hunting!

Translated by