how to write algorithm for code?

node = 3;
Link = (node-1)*node/2
NN = toeplitz(Link+1:-1:2);
mask = logical(fliplr(diag(ones(1,Link-1),-1)));
NN(mask) = 1;
for c = 0:2^Link-1
out = bitget(c, NN)
end
format long g
lamda = 0.7;
bits = dec2bin(0:2^node-1)-'0';
nl = sum(bits,2);
nu = node-nl;
P = lamda.^nl .* (1-lamda).^nu;
P(1:8)
[minP, minidx] = min(P)
bits(minidx,:)
[maxP, maxidx] = max(P)
bits(maxidx,:)
please help me to write algorithm

5 件のコメント

Walter Roberson
Walter Roberson 2021 年 4 月 7 日
Do you mean that you have the code, and you need to explain how the code works?
ankanna
ankanna 2021 年 4 月 7 日
ya
Walter Roberson
Walter Roberson 2021 年 4 月 7 日
I'm pretty sure that for the second section of code, that the person who wrote the code was making a joke to see if you would notice. The actual code is:
format long g
node = 3;
lamda = 0.7;
P1 = lamda.^node; P2 = (1-lamda).^node;
if lamda <= 0.5
minP = P1; maxP = P2;
else
minP = P2; maxP = P1;
end
[minP, maxP]
ans = 1×2
0.027 0.343
ankanna
ankanna 2021 年 4 月 10 日
How to add reliability ri=0.9 to this. Please help me to generate this code.
Walter Roberson
Walter Roberson 2021 年 4 月 11 日
Reliability does not fit with that code.

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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGet Started with Optimization Toolbox についてさらに検索

製品

リリース

R2016a

質問済み:

2021 年 3 月 22 日

コメント済み:

2021 年 4 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by