Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

could anyone help me to solve the issue in the following code

1 visualización (últimos 30 días)
jaah navi
jaah navi el 17 de Jun. de 2019
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
code:
particles=10;
users=4;
dimensions=2;
for particle=1:particles
clusters= randi(users,1);
swarm_pos = rand(clusters,dimensions);
DDD=partitions(users,clusters);
total_number_of_partitions = length(DDD);
idx=randperm(total_number_of_partitions,1);
iwant= DDD(idx);
partdisp(iwant)%remains tha same for more than one particle in some cases.But it should be different.
end
When i run the code it executes.But partdisp remains the same for more than one particle in some cases.I actually need to have different partdisp for each and every particle.Could anyone please help me on this
  2 comentarios
jaah navi
jaah navi el 18 de Jun. de 2019
Editada: Stephen23 el 18 de Jun. de 2019
EDIT: COPYRIGHT code removed. The two functions are available here:
partdisp and partitions are functions when i run the code
it gives the following result
PARTICLE = 1
The formation of clusters {1 3 2}:{1 3} {2}
PARTICLE = 2
The formation of clusters {1 2 3}:{1 2 3}
PARTICLE = 3
The formation of clusters {1 2 3}:{1} {2} {3}
PARTICLE = 4
The formation of clusters {1 2 3}:{1 2 3}
PARTICLE = 5
The formation of clusters {1 2 3}:{1} {2 3}
with respect to the above result for 5 particles the formation of clusters should not be the same
but when i run the code sometimes the formation of clusters remain the same as shown above and sometimes it differs.
Could you please help me on this.
Stephen23
Stephen23 el 18 de Jun. de 2019
@jaah navi: do NOT upload copyright code to this forum.

Respuestas (0)

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by