Generate a exponential distribution with lambda´3

2019-09-02 12:27发布

I have an assignment and now got confused about exponential distribution. The instruction say "service time is exponential distributed with intensity lambda=3." First I thought generating this is just exp(3), but using Matlab I am wondering if this is right interpretation of the text. Maybe I should use exprnd(3) instead?

1条回答
虎瘦雄心在
2楼-- · 2019-09-02 12:58

If the service time distribution, S, is exponentially distributed with rate lambda = 3, then the average service time is 1/3.

You'll see the Exponential distribution often parameterized by the rate lambda, but MATLAB uses the mean. You can see MATLAB's parameterization here in the documentation.

To generate service times, one can use exprnd directly or use the inverse transform for the Exponential distribution.

N = 4000;
lambda = 3;   % Rate  Note: AvgSvcTime = 1 / lambda

SvcTimes = exprnd(1/lambda,N,1);  % Approach 1

U = rand(N,1);                    % U ~ Uniform(0,1)
SvcTimes2 = -(1/lambda)*log(1-U); % Approach 2 with Inverse Transform

Theoretical vs Empirical PDF

Note: You can replace 1-U with U since they are equal in distribution.

查看更多
登录 后发表回答