|
"Aggelos" wrote in message <ja8cjm$11f$1@newscl01ah.mathworks.com>...
> Hello everyone,
>
> I have the density function f(d)=2d, where d is the distance of a user and 0<=d=<1 (kilometers). My system has 64 users and i want the distance d of a user to be generated randomly with the above density function. I have programmed a code but i believe it's not responding in my needs. Can someone explain me how can i simulate this ? My code is following.
>
> PROB=[.01 .03 .05 .07 .09 .11 .13 .15 .17 .19] ;
> temporary = randp(PROB,N);
> d=zeros(1,N);
> d=0.1.*temporary(1,:);
Just forget my code. It's absolutely rubbish. I want the distance to be a random number (according to the density function) between 1meter and 999 meters, not just 100, 200, 300...800, 900 and 1000 as the my code does.
|