edit erfinv edit simulacodamm1.m edit codamm1.m edit codamm1.m s=[1,2,3,2,3,4,3,2,1,2,3,2,1] s = Columns 1 through 8 1 2 3 2 3 4 3 2 Columns 9 through 13 1 2 3 2 1 find(s==1) ans = 1 9 13 s=[1,2,3,2,3,4,3,2,1,2,3,2,1,2,3] s = Columns 1 through 8 1 2 3 2 3 4 3 2 Columns 9 through 15 1 2 3 2 1 2 3 find(s==1) ans = 1 9 13 ciclo=s(1:8) ciclo = 1 2 3 2 3 4 3 2 w=rand(1,8) w = Columns 1 through 5 0.8147 0.9058 0.1270 0.9134 0.6324 Columns 6 through 8 0.0975 0.2785 0.5469 permanenza(4,ciclo,tempi) ??? Undefined function or variable 'tempi'. tempi=w tempi = Columns 1 through 5 0.8147 0.9058 0.1270 0.9134 0.6324 Columns 6 through 8 0.0975 0.2785 0.5469 permanenza(4,ciclo,tempi) ans = 0.8147 2.3660 1.0378 0.0975 permanenza(5,ciclo,tempi) ans = 0.8147 2.3660 1.0378 0.0975 0 permanenza(4,ciclo,tempi) ans = 0.8147 2.3660 1.0378 0.0975 tempi tempi = Columns 1 through 5 0.8147 0.9058 0.1270 0.9134 0.6324 Columns 6 through 8 0.0975 0.2785 0.5469 ciclo ciclo = 1 2 3 2 3 4 3 2 tempi tempi = Columns 1 through 5 0.8147 0.9058 0.1270 0.9134 0.6324 Columns 6 through 8 0.0975 0.2785 0.5469 tempi(2)+tempi(4)+tempi(8) ans = 2.3660 permanenza(4,ciclo,tempi) ans = 0.8147 2.3660 1.0378 0.0975 ciclo ciclo = 1 2 3 2 3 4 3 2 codamm1 ??? Undefined function or variable 'nstati'. Error in ==> codamm1 at 31 tautot = zeros(1,nstati); codamm1 ans = 0.0178 A=[1,0;0,1] A = 1 0 0 1 exp(A) ans = 2.7183 1.0000 1.0000 2.7183 expm(A) ans = 2.7183 0 0 2.7183 exp(-10) ans = 4.5400e-05 Q=randstoc(3) Q = 0.4607 0.4050 0.1343 0.2358 0.5367 0.2275 0.5385 0.4203 0.0412 isstoc(Q) ans = 1 lambda=rand(1,3) lambda = 0.6322 0.6556 0.2821 A=diag(lambda)*(Q-eye(size(Q))) A = -0.3410 0.2561 0.0849 0.1546 -0.3037 0.1491 0.1519 0.1186 -0.2705 A=diag(lambda)*(Q-eye(size(Q))) A = -0.3410 0.2561 0.0849 0.1546 -0.3037 0.1491 0.1519 0.1186 -0.2705 det(A) ans = 0 Q=[0,1/3,2/3;1/3,0,2/3;1,0,0] Q = 0 0.3333 0.6667 0.3333 0 0.6667 1.0000 0 0 A=diag(lambda)*(Q-eye(size(Q))) A = -0.6322 0.2107 0.4215 0.2185 -0.6556 0.4371 0.2821 0 -0.2821 lambda lambda = 0.6322 0.6556 0.2821 Q(1,2)*lambda(1) ans = 0.2107 diary off