Finding minimum value by using min()

조회 수: 3 (최근 30일)
Sushree Patra
Sushree Patra 2018년 12월 7일
댓글: Image Analyst 2018년 12월 7일
I want to find minimum 10 value
i wrote
for j= 1:10
for i= 1:10
for k = 1:13
fitness (j,i,k)=(........);%10*10*13 double
end
end
minfit(j) = min(fitness(j,:));
end
disp (minfit);
in min function it is unable to find
minimum value of .
please helpme i am not able to solfitnesse

채택된 답변

Image Analyst
Image Analyst 2018년 12월 7일
To find the 10 minimum values of any array, just sort:
sortedValues = sort(fitness(:), 'descend');
tenMinValues = sortedValues(1:10);
If you don't want duplicated values, use unique
sortedValues = unique(fitness(:));
tenMinValues = sortedValues(1:10);
  댓글 수: 6
Sushree Patra
Sushree Patra 2018년 12월 7일
Thank you sir for the response.
Well, it is different in case of movement of krill and finding the next generation they specifically use free search operator and opposition based method for population intialization.
And I asked to the author but they don't reply.
So I am trying by myself.
Please help me if I am unable to solve.
Image Analyst
Image Analyst 2018년 12월 7일
I've done all the help I can do. See the FAQ
I'm not an expert in PSO-type algorithms, and haven't used them (not needed to so far).

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

madhan ravi
madhan ravi 2018년 12월 7일
편집: madhan ravi 2018년 12월 7일
minFit=squeeze(min(Ofitness,[],[1 2])).'
minFit=squeeze(min(min(Ofitness))).' % in older versions of matlab thank you sir Walter
  댓글 수: 32
madhan ravi
madhan ravi 2018년 12월 7일
A(:,:,1)=[1,5;6,2];
A(:,:,2)=[9,5;3,6];
B(:,:,1)=[9,2;6,3];
B(:,:,2)=[7,3;8,4];
result=[min(A(:)) min(B(:))]
Sushree Patra
Sushree Patra 2018년 12월 7일
Thank you sir but in my code how it will fix

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Problem-Based Optimization Setup에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by