使用lambda´3生成指数分布 [英] Generate a exponential distribution with lambda´3

查看:153
本文介绍了使用lambda´3生成指数分布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个作业,现在对指数分布感到困惑.指令说服务时间是强度lambda=3的指数分布".首先,我认为生成的只是exp(3),但是使用Matlab我想知道这是否是对文本的正确解释.也许我应该改用exprnd(3)吗?

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?

推荐答案

如果服务时间分布S以λ= 3的速率呈指数分布,则平均服务时间为1/3.

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

您会看到指数分布通常由lambda速率参数化,但是MATLAB使用均值.您可以在文档中的此处查看.

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.

要生成服务时间,可以直接使用exprnd或使用逆变换指数分布.

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

注意:您可以将1-U替换为U,因为它们的分布相等.

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

这篇关于使用lambda´3生成指数分布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆