how to solve this fitness function to get fitness values for 100 nodes

1 回表示 (過去 30 日間)
SARAH LONER
SARAH LONER 2020 年 1 月 22 日
コメント済み: Walter Roberson 2020 年 1 月 22 日
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

採用された回答

Walter Roberson
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 件のコメント
SARAH LONER
SARAH LONER 2020 年 1 月 22 日
thank u sir. had one more doubt if i use .* instead mod it also showing empty array
Walter Roberson
Walter Roberson 2020 年 1 月 22 日
What is your revised code?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by