# how to generate?

3 views (last 30 days)
ankanna on 18 Apr 2021
Commented: ankanna on 24 Apr 2021
format long g
nodes = 10;
lamda = 0.7;
bits = dec2bin(0:2^nodes-1)-'0';
nl = sum(bits,2);
nu = nodes-nl;
P = lamda.^nl .* (1-lamda).^nu;
P(1:20)
I see the answer works, but my question is why does the "- '0'" part changes the outcome from a series of chars to a doube format?
ankanna on 18 Apr 2021

David Fletcher on 18 Apr 2021
Edited: David Fletcher on 18 Apr 2021
Consider the ASCII value for zero - the only way a computer can make sense of the subtraction is to subtract their ASCII values. So '0' - '0' results in a double of value zero. This also works for a '1' since the ASCII value for '1' is one greater than the ASCII value for '0'. So '1' - '0' results in a double value of 1
ankanna on 24 Apr 2021
n = 3;
l = bitget(c, NN)
end
the above code i generate all configuration matrix.
i need to generate all paths in this network.

### Categories

Find more on Math Operations in Help Center and File Exchange

R2016a

### Community Treasure Hunt

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

Start Hunting!

Translated by