How to fit trapezoid distribution?
1 view (last 30 days)
Show older comments
Dear Matlab community,
please help about my problem.
I am running Monte Carlo (MC) simulation and it is obvious that output value is distributed as trapezoid distribution (resulting from two uniform distributions). I have to fit this distribution to the data so I can use that distribution as input value to the next MC simulation. The most commonly used tools, such as dfittool, do not contain predefined trapezoid distribution so I have to find another solution.
Is there any idea how to solve it?
Best regards and thanks in advance,
Ivan
0 Comments
Answers (1)
Ambrosio Valencia-Romero
on 29 Nov 2016
Use function trapmf as:
p = trapmf(r,[a b c d]);
with r as your uniformly distributed random number, and a <= r <= d.
You can generate r with the rand function as follows:
r = a + (d - a)*rand;
I hope it works for you.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!