How to use "poissrnd" function?

16 views (last 30 days)
Maria
Maria on 4 Oct 2022
Edited: Torsten on 5 Oct 2022
Hello!
I'm trying to use "poissrnd" function in order to generate an arrival of task each minute. But i use a time frame in second.
lambda = 4;
v = poissrnd(lambda, 1, 3600);
with this command , i get an arrival each second, but i want the result "task/ min"
T=3600 and taux =1 s
lambda = 4 task/ min
i will be grateful if you could find me a solution! Thank you in advance

Answers (1)

Torsten
Torsten on 4 Oct 2022
Edited: Torsten on 5 Oct 2022
lambda = 4
What is the unit of lambda ? Mean number of arrivals per minute ?
And you want to get a random vector for arrivals in each second ?
Note that the "3600" in the line
v = poissrnd(lambda, 1, 3600);
has nothing to do with time units (seconds in this case). It's only the number of random values "poissrnd" should return.
  25 Comments
Torsten
Torsten on 4 Oct 2022
Edited: Torsten on 4 Oct 2022
You already used all 60 for the other positions.
If you want a value at position 3600, v must be of size 61:
v = rand(1,61);
m = zeros(1,3600);
m(1) = v(1);
m((1:60)*60) = v(2:61);
All this confusion is unnecessary. The usual way is to put values at positions 1, 61, 121, ..., 3541. Then the distance between the non-zero elements is the same throughout the vector (60) and v has the usual size 1x60.
Maria
Maria on 5 Oct 2022
@Torsten okay! i really appreciate your effort ant time, thank you for your help

Sign in to comment.

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!