필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

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

조회 수: 1 (최근 30일)
jaah navi
jaah navi 2019년 6월 17일
마감: MATLAB Answer Bot 2021년 8월 20일
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.
Stephen23
Stephen23 2019년 6월 18일
@jaah navi: do NOT upload copyright code to this forum.

답변 (0개)

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by