필터 지우기
필터 지우기

Info

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

Could anyone help me to solve the issue in the following code.

조회 수: 2 (최근 30일)
jaah navi
jaah navi 2019년 5월 8일
마감: MATLAB Answer Bot 2021년 8월 20일
I posted this code already as i unable to get the output till now I am posting it again.
code:
iterations=2;
particles=2;
dimensions=2;
PPP=[1,2;
3,4;
5,6;
7,8];
centroids=zeros(1,particles);
for particle=1:particles
P=numel(particle);
users=size(PPP,1);
centroids(particle)= randi(users,1,P);
fprintf('\nCentroids=%d\n',centroids(particle))
swarm_pos = rand(centroids(particle),dimensions,P)
end
for T=1:iterations
for particle=1:particles
P=numel(particle);
distances=zeros(users,centroids(particle),P)
for centroid=1:centroids(particle)
distance=zeros(users,1)
for data_vector=1:users
distance(data_vector,1)=norm(swarm_pos(centroid,:,P)-PPP(data_vector,:))
end
distances(:,centroid,P)=distance
end
end
end
when i run the code swarm_pos with respect to norm is not considered for first displayed centroids.
Could anyone please help me to overcome it.
  댓글 수: 2
KSSV
KSSV 2019년 5월 8일
Same questions.......you asked this kind and it is being dicussed.....
jaah navi
jaah navi 2019년 5월 8일
Yes.But I am unable to get with the solution.
Could you please help me to find the solution.

답변 (0개)

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by