Institut de Robòtica i Informàtica Industrial

RandVector

PURPOSE ^

Selects and element from a discrete probability distribution.

SYNOPSIS ^

function i=RandVector(v)

DESCRIPTION ^

   Selects and element from a discrete probability distribution.

   Returns an element at random using the (absolute) values of the input 
   vector as selection weights.

CROSS-REFERENCE INFORMATION ^

This function calls:
  • rand Random state from a discrete belief.
  • rand Random state from a belief.
  • rand Generates random points on a GMixture.
  • rand Generates random ponts on a Gaussian.
  • rand Random state from a continuous space.
  • rand Random state from a discrete space.
This function is called by:
  • Prediction Belief evolution under the given action.
  • Prediction Belief evolution under the given action.
  • rand Random state from a discrete belief.
  • Update Belief evolution under an observation model.
  • rand Random state from a belief.
  • rand Generates random points on a GMixture.
  • SimulationStep Executes one step of a POMDP simulation.

SOURCE CODE ^

0001 function i=RandVector(v)
0002 %   Selects and element from a discrete probability distribution.
0003 %
0004 %   Returns an element at random using the (absolute) values of the input
0005 %   vector as selection weights.
0006 
0007   va=abs(v);
0008 
0009   r=rand*sum(va);
0010   i=1;
0011   s=va(i);
0012   while s<r
0013     i=i+1;
0014     s=s+va(i);
0015   end


Institut de Robòtica i Informàtica Industrial

Generated on Wed 05-Aug-2009 15:05:21 by m2html © 2003