# Time Sequence Markov to Probability Matrix

2 visualizaciones (últimos 30 días)
David No el 29 de Mzo. de 2020
Respondida: Anurag Agrawal el 1 de Abr. de 2020
Stuck on this problem where I need to generate a program that will take user input and generate a probability matrix (full problem shown below). I figured out how to create the user input via inputdlg function, but clueless in how to generate a matrix, let alone one that can calculate the probabilities in them. I'm guessing it's a for-loop, but I'm a Matlab rookie. Any help would be greatly appreciated.
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

### Respuestas (1)

Anurag Agrawal el 1 de Abr. de 2020
You can start with creating a square maxtrix of zeros. See this for more details:
M= zeros(n); %where n is the number of states
Then you use a nested for loop to update each of the values of the matrix according to your algorithm.
for c = 1:n
for r = 1:n
%Your code to calculate each value of the Matrix
M(r,c) = %desired probability
end
end
Also, there are some inbuilt functions for Markov Chain Modelling, you can have a look at:
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

### Categorías

Más información sobre Markov Chain Models en Help Center y File Exchange.

### Community Treasure Hunt

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

Start Hunting!

Translated by