Info

此问题已关闭。 请重新打开它进行编辑或回答。

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

1 次查看(过去 30 天)
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 个评论
jaah navi
jaah navi 2019-6-18
编辑:Stephen23 2019-6-18
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.

回答(0 个)

此问题已关闭。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by