필터 지우기
필터 지우기

probability in Markov chain

조회 수: 3 (최근 30일)
lemontree45
lemontree45 2011년 6월 27일
댓글: Walter Roberson 2020년 7월 30일
Given, a state sequence (100 elements) of two different states '1' or '2'. find the probability of occurance of '1' and '2'(P1 and P2).
Also find the probability of occurance of P11,P12,P21,P22 where P11(probability of the state remaining in the state 1 during a transition and similarly others) represents the elements of state transition probability matrix.
Any sort of help would be appreciated.
Thanks & Regards
  댓글 수: 1
SATYANARAYANA R
SATYANARAYANA R 2020년 7월 30일
please provide
step- by -step solution

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

채택된 답변

Fangjun Jiang
Fangjun Jiang 2011년 6월 27일
I can write the code in a couple of minutes. But let's see if you can help me to help you.
1. Generate a vector of 100x1 or 1x100. The data is a random distribution of '1' and '2'. You can use rand(). Or randint() is even better.
2. set your P=zeros(2,2)
3. Go through a for-loop. If the vector value goes from 1 to 1, P(1,1) is increased by 1. If the values goes from 1 to 2, P(1,2) is increased by 1. And so on.
4. At the end, divide P by 100 (your data length), you get your probability matrix.
EDIT This is incorrect. Should divide the first row by the total number of 1s and divide the second row by the total number of 2s.
Start writing your MATLAB code, if you have particular questions regarding using MATLAB functions, or M-script syntax. People here would love to help you.
  댓글 수: 2
SATYANARAYANA R
SATYANARAYANA R 2020년 7월 30일
please provide MATLAB CODES
Walter Roberson
Walter Roberson 2020년 7월 30일
SATYANARAYANA R: it is a homework question, and we avoid giving complete solutions to homework questions. Fangjun has given an outline of what you need to do. You should make a start at the code, and you can come back and ask specific questions if you have trouble getting your code to work.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Markov Chain Models에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by