Convolution and tolerances: how do I calculate the probability density function of the difference between two dimensions? (mechanical engieering)

조회 수: 9 (최근 30일)
Say I have a shaft of diameter 99.5-100 mm and a hole of diameter 100-101 mm.
The mininum clearance is then 0 mm (smallest hole, largest shaft) and maximum clearance is 1.5 mm (largest hole, smallest shaft).
But how do I calculate the probability distribution for that clearance between 0 and 1.5 mm, assuming the shaft and hole each follow some known probability distribution?
For the sake of simplicity, assume the shaft & hole follow a uniform distribution, i.e. all diameters within the tolerance range are as likely.
How do I compute the PDF (probability density function) for the clearance, i.e. the difference between the hole and shaft?
x=[99.5:0.01:101];
pShaft=zeros(size(x));
pHole=zeros(size(x));
pShaft(x>=99.5&x<100)=1/0.5; % uniform distribution: (tol width)*P=1
pHole(x>=100&x<=101)=1; % uniform distirbution: (tol width)*P=1

채택된 답변

Jeff Miller
Jeff Miller 2020년 5월 4일
In general, if h(x) and s(x) are the PDFs of the hole and shaft, respectively, then the PDF d(x) of the difference d=h-s is
d(x) = \integral s(u) h(u+x) du
(I guess you can work out the limits of integration for a given x)
  댓글 수: 3
Jeff Miller
Jeff Miller 2020년 5월 4일
Yes, it's called a convolution in stats, but I think matlab's conv function is for something different.
If you want to look at these for lots of different h & s distributions families and don't want to program up the pdfs and integrals yourself, have a look at Cupid. It has a difference distribution type so you can say things like
h = Uniform(100,101); % with lots of alternatives if you don't want a uniform here
s = Uniform(99.5,100);
d = Difference(h,s); % form the distribution of the difference
d.PlotDens; % plot the pdf and cdf of the difference distribution;
% many other functions are available.
By the way, I should have said that all this assumes h and s are stochastically independent.
Mats Lindqvist
Mats Lindqvist 2020년 5월 4일
Thanks Jeff for the explanation, and for that link - that's a great resource. This really helps me. My question was actually raised as a colleague sent me a stackup-tolerance analysis using something called the "RSS" method; "Root Sum Squared". I feel I need to understand the topic better, to formulate a reply that makes sense. It seems to me that the RSS approach is a simplified one.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

John D'Errico
John D'Errico 2020년 5월 4일
Jeff has already answered this to my satisfaction, so I have upvoted his answer. But just to expand on things, to add some thoughts...
This is a common problem in engineering, often called stack tolerancing. I also seeem to recall the name interference tolerancing. That is, you have two components A and B. They are manufactured by some process, so they each have a distribution of sizes. Will they fit properly together, perhaps into a hole or window of known size? In this case, we have a shaft, and a hole into which it must fit. So what matters is if the difference of the two components is a negative number, as that would signify the two will not fit together as designed.
In any case, one thing of importance is to know the actual distributions of the parameters. But, suppose the two distiributions were normal (Gaussian)? We know how to compute the distribution of the sum of two normally distributed random variables. The difference is the same thing, since we can just negate one of them, then take the sum. So if they were both normally distributed, then the difference distribution is also normal, with parameters
Mean = MuA - MuB
Var = VarA + VarB
Or, if you want to work with standard deviations, then we have a root of a sum of squares as
std = sqrt(stdA^2 + stdB^2)
My guess is this is what you are thinking of in terms of the RSS. It works nicely for normal distributions, in that the result is also normally distributed. In the real world however, we never seem to have normally distributed parts. We do inspections, and throw away the washers that are too thick or too thin. They get melted down if they fall out of specs. So the distributions of our parts are probably better described as truncated normal, with the tails at each end chopped off fairly cleanly. You may be willing to assume uniform over the spec interval, but that may be a poor approximation.
Now, can we just assume the mean of the difference is just the difference of the means? That is, does this still work?
Mean = MuA - MuB,
Var = VarA + VarB
Yes. However, be careful, as the result is no longer normally distributed. A mean and a variance are just expectations. Things don't need to be normally distributed for their mean and variance to exist and for the same rules to apply.
If the original distributions were indeed uniform, then the difference would have followed a triangular distribution.
X = rand(1e7,2);
Y = diff(X,[],2);
histogram(Y,1000)
The variance of a uniform is (b-a)^2/12, so in that example, both columns of X will have variance 1/12. The differeence distribution will have variance 1/6.
var(Y)
ans =
0.16661
Per theory, things have worked nicely. Be careful of course, as what you really want to know now is the probability the difference is negative. (Or more generally, if the derived parameters is greater or less than some number as that passes a go/no go limit.)
Now you need to start getting more deeply into the tolerance analysis, and for that to happen, you want to have at least a decent handle on the true distributions of A and B. A simple solution that is easily employed is to use Monte Carlo, since then you just count the failures to know the predicted probability of failure. This may fail when you get far into the tails of course, as you may be worried about a process that is crucial. For example, if your part becomes part of a mission to Mars, you need things to work with essentially little risk of failure.
  댓글 수: 1
Mats Lindqvist
Mats Lindqvist 2020년 5월 4일
Thanks John for elaborating on the topic, and you are rigth, the normal distribution is probably a bad choice in my case; actually I think the uniform, or truncated normal distribution is closer to reality. It also seems like the knowledge, techniques and tools concerning tolerancing and quality control in manufacturing, are developed for mass-production (automotive industry?) which is not what I'm working in. Some of our parts are ordered and manufactured one by one. Some are made a few at the time. No "6-sigma" here...

댓글을 달려면 로그인하십시오.

제품

Community Treasure Hunt

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

Start Hunting!

Translated by