Home > src > PF > initParticles.m

initParticles

PURPOSE ^

SYNOPSIS ^

function init = initParticles( no_of_particles, no_of_attributes, pos, max_speed )

DESCRIPTION ^

 INITPARTICLES( NO_OF_PARTICLES, POS )

 param: no_of_particles - 
 param: no_of_attributes - 
 param: pos - target position 
 param: max_speed - target max_speed

 AUTHOR:  Ronnie Johansson
 CREATED: 2004-12-09
 ALTERED: 2004-12-21

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function init = initParticles( no_of_particles, no_of_attributes, pos, max_speed )
0002 %
0003 % INITPARTICLES( NO_OF_PARTICLES, POS )
0004 %
0005 % param: no_of_particles -
0006 % param: no_of_attributes -
0007 % param: pos - target position
0008 % param: max_speed - target max_speed
0009 %
0010 % AUTHOR:  Ronnie Johansson
0011 % CREATED: 2004-12-09
0012 % ALTERED: 2004-12-21
0013 %
0014 
0015 % NOTE! Has not been thoroughly tested
0016 
0017 init = zeros( no_of_particles, no_of_attributes );
0018 
0019 init(:,1:2) = ones(no_of_particles,1)*pos;
0020 
0021 % select speeds and angles uniformly
0022 speed = rand(no_of_particles,1)*max_speed;
0023 angles = rand(no_of_particles,1)*2*pi;
0024 
0025 init(:,3:4) = [speed angles];

Generated on Wed 16-Mar-2005 09:17:47 by m2html © 2003