0

I have an assignment and now got confused about exponential distribution. The instructions 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?

SecretAgentMan
  • 2,856
  • 7
  • 21
  • 41
Orongo
  • 285
  • 1
  • 6
  • 16
  • Yes, `exprnd`. You probably need `exprnd(1/3)` rather than `exprnd(3)` (intensity is the inverse of average service time). `exp` is just exponential. Note also that [`exprnd`](http://es.mathworks.com/help/stats/exprnd.html) accepts additional parameters if you need to generate an array rather than a number – Luis Mendo May 30 '16 at 15:54
  • Thank. Just what I needed to hear. The assignments had me question everything and I'm not confident enough now to do much without confirmation. Thank you again. – Orongo May 30 '16 at 16:07

1 Answers1

0

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.

SecretAgentMan
  • 2,856
  • 7
  • 21
  • 41