how to solve this fitness function to get fitness values for 100 nodes
조회 수: 1 (최근 30일)
이전 댓글 표시
if i take probability of fitness for p1 and p2
p1=0.7 and p2=0.3
where n is number of nodes in wireless sensor network
for i=1:n
Fit = p1|(nerst(:))| + p2 .*sum (resdialenergy(:))
fprintf('fitness value is : %d values.\n', Fit);
end
here im not getting any fitness values it showing empty array for all node. tell me how to solve that
댓글 수: 0
채택된 답변
Walter Roberson
2020년 1월 22일
편집: Walter Roberson
2020년 1월 22일
MATLAB does not use | expression | to take absolute value. MATLAB also has no implied multiplication so A|B| does not mean to multiply A by the absolute value of B.
In MATLAB the | operation is elementwise logical OR, which is true if corresponding positions in the left and right arrays are not both 0
댓글 수: 2
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!