Generate possible sequences of m^n elements. Each sequence containing 10 bits.

조회 수: 1 (최근 30일)
I am trying to generate a set of binary sequence.
The entire set of possible sequences contain 5^10 = 976525 elements. And sequence of each elements must be restricted to having 10bits. A sequence for example: 0011010110.
I tried doing
A = dec2bin(1:5^10)
It gives me the right number of elements, but gives me 21 characters

채택된 답변

Walter Roberson
Walter Roberson 2021년 12월 19일
That cannot be done in a unique way.
In order to represent n elements in n bits, each element can only carry one bit. The value 5 requires more than 2 bits, so 10 of those would take slightly more than 2*10 = 20 bits.
10 bits can only represent 2^10 = 1024 different values, but you have 976525 different values to represent, about 950 times higher.
  댓글 수: 1
Md. Sakib-Ul-Islam
Md. Sakib-Ul-Islam 2021년 12월 19일
편집: Md. Sakib-Ul-Islam 2021년 12월 19일
understood. so if i have to take a sample space with sequences of 10 bits, then i will have elements less than 976525? or will i not be able to take at all?

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by