Consider the following code (Matlab)
function counter = ross_fpt_uniform
%ROSS_FPT_UNIFORM generates the first passage time of the sum of uniform
% random variables exceeding level 1.
s = 0;
counter = 0;
while (s <= 1)
s = s + rand(1,1);
counter = counter + 1;
end
end %ross_fpt_uniform
I am having problems translating function counter = ross_fpt_uniform
in R
Confuses me how should I treat the counter
because here counter = counter + 1;
seems like it's a variable. Is it a function or a variable and how do I write on R?
Could someone please help ?
Aucun commentaire:
Enregistrer un commentaire