Test based on inequality of two vectors does not succeed.
Mostrar comentarios más antiguos
([1,0],[0.8,0.2;0.6,0.4])
function stationarystates( S0,T )
%This function is a simple model of a Markov chain
% S0 is the initial state
% T is the transition matrix
% I want the cumulation of states to stop after state i if state i =
% state i+1. This does not happen with this code
M=S0
for i=1:1:10
if S0*T^i~=S0*T^(i-1) %Test for inequality of successive states
M((i+1),:)=S0*T^i; %M cumulates the states
else break
end
end
disp(M)
plot(M)
end
1 comentario
Massimo Zanetti
el 31 de Oct. de 2016
Adding some explanation to summarize your problem?
Respuesta aceptada
Más respuestas (1)
Categorías
Más información sobre Physics en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!