How to use "poissrnd" function?

29 Ansichten (letzte 30 Tage)
Maria
Maria am 4 Okt. 2022
Bearbeitet: Torsten am 5 Okt. 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

Antworten (1)

Torsten
Torsten am 4 Okt. 2022
Bearbeitet: Torsten am 5 Okt. 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 Kommentare
Torsten
Torsten am 4 Okt. 2022
Bearbeitet: Torsten am 4 Okt. 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 am 5 Okt. 2022
@Torsten okay! i really appreciate your effort ant time, thank you for your help

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by