Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

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

1 vue (au cours des 30 derniers jours)
jaah navi
jaah navi le 17 Juin 2019
Clôturé : MATLAB Answer Bot le 20 Août 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 commentaires
jaah navi
jaah navi le 18 Juin 2019
Modifié(e) : Stephen23 le 18 Juin 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 le 18 Juin 2019
@jaah navi: do NOT upload copyright code to this forum.

Réponses (0)

Cette question est clôturée.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by