Generate a exponential distribution with lambda´3

送分小仙女□ 提交于 2019-12-25 17:14:55

问题


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:


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

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



来源:https://stackoverflow.com/questions/37529525/generate-a-exponential-distribution-with-lambda%c2%b43

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!