octave:4> v=v/sum(v) v = 0.16667 0.33333 0.50000 octave:5> V=repmat(v,3,1) V = 0.16667 0.33333 0.50000 0.16667 0.33333 0.50000 0.16667 0.33333 0.50000 octave:6> W=repmat(v',1,3) W = 0.16667 0.16667 0.16667 0.33333 0.33333 0.33333 0.50000 0.50000 0.50000 octave:7> V find(V P=zeros(3) P = 0 0 0 0 0 0 0 0 0 octave:10> P(index)=5 Invalid call to index. Correct usage is: -- Function File: index (S, T) -- Function File: index (S, T, DIRECTION) Additional help for built-in functions and operators is available in the on-line version of the manual. Use the command `doc ' to search the manual index. Help and information about Octave is also available on the WWW at http://www.octave.org and via the help@octave.org mailing list. Invalid call to index. Correct usage is: -- Function File: index (S, T) -- Function File: index (S, T, DIRECTION) Additional help for built-in functions and operators is available in the on-line version of the manual. Use the command `doc ' to search the manual index. Help and information about Octave is also available on the WWW at http://www.octave.org and via the help@octave.org mailing list. error: evaluating if command near line 48, column 3 error: called from `index' in file `/usr/local/octave-3.0.2/share/octave/3.0.2/m/strings/index.m' error: evaluating argument list element number 1 error: evaluating assignment expression near line 10, column 9 octave:10> index=find(V P(index)=5 P = 0 0 0 5 0 0 5 5 0 octave:12> A(index)=5 A = 0 5 5 0 0 5 octave:13> v=rand(1,5); octave:14> v=v/sum(v) v = 0.25914 0.17848 0.24847 0.10872 0.20519 octave:15> P=metropolis(v) P = 0.501405 0.173186 0.150561 0.071178 0.103670 0.251461 0.314039 0.097057 0.076223 0.261220 0.157026 0.069715 0.485330 0.082112 0.205816 0.169657 0.125127 0.187661 0.193444 0.324111 0.130927 0.227209 0.249229 0.171731 0.220904 octave:16> isstoc(P) ans = 1 octave:17> [V,D]=eig(P') V = -0.559308 -0.142622 0.669438 -0.571595 0.259803 -0.385206 0.371251 0.260712 0.440720 -0.654427 -0.536281 0.205510 -0.667720 -0.508790 -0.326139 -0.234654 0.376799 -0.088808 0.231536 0.623166 -0.442867 -0.810938 -0.173623 0.408129 0.097597 D = 1.00000 0.00000 0.00000 0.00000 0.00000 0.00000 -0.08321 0.00000 0.00000 0.00000 0.00000 0.00000 0.38625 0.00000 0.00000 0.00000 0.00000 0.00000 0.28508 0.00000 0.00000 0.00000 0.00000 0.00000 0.12699 octave:18> w=-V(:,1)/norm(V(:,1),1) w = 0.25914 0.17848 0.24847 0.10872 0.20519 octave:19> v v = 0.25914 0.17848 0.24847 0.10872 0.20519 octave:20> P P = 0.501405 0.173186 0.150561 0.071178 0.103670 0.251461 0.314039 0.097057 0.076223 0.261220 0.157026 0.069715 0.485330 0.082112 0.205816 0.169657 0.125127 0.187661 0.193444 0.324111 0.130927 0.227209 0.249229 0.171731 0.220904 octave:21> P^100 ans = 0.25914 0.17848 0.24847 0.10872 0.20519 0.25914 0.17848 0.24847 0.10872 0.20519 0.25914 0.17848 0.24847 0.10872 0.20519 0.25914 0.17848 0.24847 0.10872 0.20519 0.25914 0.17848 0.24847 0.10872 0.20519 octave:22> v v = 0.25914 0.17848 0.24847 0.10872 0.20519 octave:23> w=rand(5,1); octave:24> w=w/sum(w); octave:25> w*P^100 error: operator *: nonconformant arguments (op1 is 5x1, op2 is 5x5) error: evaluating binary operator `*' near line 25, column 2 octave:25> w w = 0.161872 0.280068 0.022084 0.286925 0.249051 octave:26> w=w' w = 0.161872 0.280068 0.022084 0.286925 0.249051 octave:27> w*P^100 ans = 0.25914 0.17848 0.24847 0.10872 0.20519 octave:28> v v = 0.25914 0.17848 0.24847 0.10872 0.20519 octave:29> quit