필터 지우기
필터 지우기

how can I use matlab to solve this probability problem?

조회 수: 1 (최근 30일)
chafah zachary
chafah zachary 2014년 3월 24일
댓글: Star Strider 2014년 3월 25일
Consider a binary code with 6 bits (0 or 1) in each code word.
(a) How many code words have exactly three successive 0’s? (b) What is the probability of the code word 000111?
I tried using matlab to no avail.

채택된 답변

Star Strider
Star Strider 2014년 3월 25일
I guess I’m revealing my intellectual ineptitude for all to see, but I actually wrote a short routine to explore that.
First, the probability of 000111 is 1/64. That is obvious.
Allowing for repeated occurrences, so that 0000 would count as two occurrences for instance, this codelet surprised me with the result (length(z)):
for k1 = 1:64
q(k1,:) = dec2bin(k1-1,6);
z3{k1} = strfind(q(k1,:),'000');
end
z = find(cell2mat(z3));
I wouldn’t mind an analytical proof of this. It’s not obvious to me.
  댓글 수: 4
Roger Stafford
Roger Stafford 2014년 3월 25일
The request stated "How many code words have exactly three successive 0’s?" It doesn't say, "how many have just three zeros and these must be successive." I see precisely twelve different six-bit words that have exactly three successive zeros, regardless of whether there might be other zeros:
000100
000101
000110
000111
001000
010001
011000
100010
100011
101000
111000
110001
However Chafah is the final arbiter of what was meant in the request.
Star Strider
Star Strider 2014년 3월 25일
OK. I read it differently at the outset.

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

추가 답변 (1개)

Roger Stafford
Roger Stafford 2014년 3월 24일
That's the kind of problem that can be solved mentally faster than a program can be written to do it. So why bother using matlab?

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by