octave:2> aux=[2 0 0; 0 -3 0;0 0 5] aux = 2 0 0 0 -3 0 0 0 5 octave:3> pp=rand(3,3) pp = 0.35568 0.92289 0.77243 0.57419 0.89056 0.67055 0.38089 0.61806 0.15740 octave:4> b=pp*aux*inv(pp) b = -8.8462 21.0056 -21.5376 -10.5190 21.8278 -20.0677 -7.5169 11.9409 -8.9816 octave:5> [s,lambda]=eig(b) s = 0.64825 -0.45870 -0.74637 0.62554 -0.74049 -0.64792 0.43413 -0.49120 -0.15209 lambda = Diagonal Matrix -3.0000 0 0 0 2.0000 0 0 0 5.0000 octave:6> eig(aux) ans = -3 2 5 octave:7> help eig `eig' is a function from the file /usr/lib/octave/3.2.4/oct/x86_64-pc-linux-gnu/eig.oct -- Loadable Function: LAMBDA = eig (A) -- Loadable Function: LAMBDA = eig (A, B) -- Loadable Function: [V, LAMBDA] = eig (A) -- Loadable Function: [V, LAMBDA] = eig (A, B) The eigenvalues (and eigenvectors) of a matrix are computed in a several step process which begins with a Hessenberg decomposition, followed by a Schur decomposition, from which the eigenvalues are apparent. The eigenvectors, when desired, are computed by further manipulations of the Schur decomposition. The eigenvalues returned by `eig' are not ordered. See also: eigs 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. octave:8> b b = -8.8462 21.0056 -21.5376 -10.5190 21.8278 -20.0677 -7.5169 11.9409 -8.9816 octave:9> inv(s)*b*s ans = -3.0000e+00 1.4381e-14 3.3778e-14 -5.3725e-15 2.0000e+00 2.5960e-14 1.9585e-15 2.3506e-15 5.0000e+00 octave:10> s(:,1) ans = 0.64825 0.62554 0.43413 octave:11> c=b*s(:,1) c = -1.9447 -1.8766 -1.3024 octave:12> c./s(:,1) ans = -3.0000 -3.0000 -3.0000 octave:13> lambda lambda = Diagonal Matrix -3.0000 0 0 0 2.0000 0 0 0 5.0000 octave:14> s(:,2) ans = -0.45870 -0.74049 -0.49120 octave:15> c=b*s(:,2) c = -0.91739 -1.48098 -0.98240 octave:16> c./s(:,2) ans = 2.0000 2.0000 2.0000 octave:17> b b = -8.8462 21.0056 -21.5376 -10.5190 21.8278 -20.0677 -7.5169 11.9409 -8.9816 octave:18> [q,r]=qr(b) q = -0.564694 0.620013 0.544707 -0.671475 0.038575 -0.740022 -0.479835 -0.783643 0.394540 r = 15.66549 -32.24820 29.94679 0.00000 4.50834 -7.08938 0.00000 0.00000 -0.42478 octave:19> q'*q ans = 1.0000e+00 -1.3390e-17 -5.2245e-17 -1.3390e-17 1.0000e+00 -1.8212e-16 -5.2245e-17 -1.8212e-16 1.0000e+00 octave:20> b-q*r ans = 0.0000e+00 -7.1054e-15 3.5527e-15 0.0000e+00 -3.5527e-15 3.5527e-15 0.0000e+00 -3.5527e-15 3.5527e-15 octave:21> bn=r*q bn = -1.56186 -14.99878 44.21269 0.37450 5.72945 -6.13331 0.20382 0.33287 -0.16759 octave:22> [qn,rn]=qr(bn); octave:23> bn=rn*qn bn = -3.44955 -39.91682 -24.33617 -0.61316 2.08323 -1.54612 0.87514 4.33114 5.36632 octave:24> [qn,rn]=qr(bn); octave:25> bn=rn*qn bn = -4.02958 -19.21235 41.84004 1.11836 7.36172 -7.80449 0.19278 0.38679 0.66787 octave:26> for i=1:100, [qn,rn]=qr(bn); bn=rn*qn; end octave:27> bn bn = 5.0000e+00 -2.5808e+01 3.8061e+01 4.8401e-22 -3.0000e+00 1.0011e+01 -1.2818e-40 2.1499e-18 2.0000e+00 octave:28> nodiag=[3 0 0; 0 -2 4; 0 -4 5] nodiag = 3 0 0 0 -2 4 0 -4 5 octave:29> eig(nodiag) ans = 1.5000 + 1.9365i 1.5000 - 1.9365i 3.0000 + 0.0000i octave:30> bn=pp*nodiag*inv(pp) bn = -14.7879 37.7638 -40.3185 -16.4613 38.0800 -37.5115 -8.5281 18.7434 -17.2921 octave:31> [qn,rn]=qr(bn); octave:32> bn=rn*qn bn = 3.943778 11.031943 83.289146 -0.020264 1.871462 -6.611575 -0.085731 -0.123886 0.184760 octave:33> for i=1:100, [qn,rn]=qr(bn); bn=rn*qn; end octave:34> bn=rn*qn bn = 3.0000e+00 -1.3810e+00 -8.0745e+01 -6.0834e-10 2.2906e+00 -2.4191e+01 -2.8220e-10 1.8086e-01 7.0939e-01 octave:35> for i=1:100, [qn,rn]=qr(bn); bn=rn*qn; end octave:36> bn=rn*qn bn = 3.0000e+00 -1.8780e+00 -8.0735e+01 6.0719e-19 2.1427e+00 -2.4200e+01 4.3165e-19 1.7203e-01 8.5726e-01 octave:37> for i=1:100, [qn,rn]=qr(bn); bn=rn*qn; end octave:38> bn=rn*qn bn = 3.0000e+00 -2.3532e+00 -8.0722e+01 -4.0357e-28 2.0013e+00 -2.4207e+01 -6.6359e-28 1.6530e-01 9.9873e-01 octave:39> for i=1:100, [qn,rn]=qr(bn); bn=rn*qn; end octave:40> bn=rn*qn bn = 3.0000e+00 2.8119e+00 8.0708e+01 2.3092e-37 1.8646e+00 -2.4211e+01 -1.0251e-36 1.6038e-01 1.1354e+00 octave:41> for i=1:10000, [qn,rn]=qr(bn); bn=rn*qn; end octave:42> bn=rn*qn bn = 3.00000 -5.98366 -80.53460 0.00000 0.91838 -24.20291 0.00000 0.16892 2.08162 octave:43> leitura octave:44> plotsimple(xx,-1,61,-20,26) octave:45> grav=0 grav = 0 octave:46> ff=res(xx); octave:47> err=norm(ff,inf) err = 3.3561e-08 octave:48> mm=jac(xx); octave:49> nb nb = 1506 octave:50> nv nv = 427 octave:51> length(ff) ans = 854 octave:52> spy(mm) octave:53> xx=xx-mm\ff; octave:54> ff=res(xx); octave:55> err=norm(ff,inf) err = 1.8227e-13 octave:56> mm=jac(xx); octave:57> [s,lambda]=eig(mm); octave:58> for i=1:854,aaa(i)=lambda(i,i);end octave:59> plot(aaa) octave:60> plot(aaa(1:800) > ) octave:61> plot(aaa(51:100)) octave:62> plot(aaa(41:100)) octave:63> aaa(50:60) ans = Columns 1 through 8: -0.0018700 -0.0126463 -0.1578413 -0.0424667 -0.0397543 -0.1003615 -0.1932540 -0.3259420 Columns 9 through 11: -0.3504215 -0.5015889 -0.6099250 octave:64> plot(aaa(41:100),"x") octave:65> omega(1)=sqrt(-lambda(50,50)) omega = 0.043243 octave:66> omega(2)=sqrt(-lambda(51,51)) omega = 0.043243 0.112456 octave:67> omega(3)=sqrt(-lambda(54,54)) omega = 0.043243 0.112456 0.199385 octave:68> omega(4)=sqrt(-lambda(53,53)) omega = 0.043243 0.112456 0.199385 0.206074 octave:69> omega(5)=sqrt(-lambda(55,55)) omega = 0.043243 0.112456 0.199385 0.206074 0.316799 octave:70> norm(s(:,50),inf) ans = 0.076927 octave:71> plotsimple(xx+50*s(:,50),0,60,-15,21) octave:72> plotsimple(xx+50*s(:,51),0,60,-15,21) octave:73> plotsimple(xx+50*s(:,54),0,60,-15,21) octave:74> plotsimple(xx+50*s(:,53),0,60,-15,21) octave:75> plotsimple(xx+50*s(:,55),0,60,-15,21) octave:76> plotsimple(xx+50*s(:,52),0,60,-15,21) octave:77> plotsimple(xx+50*s(:,56),0,60,-15,21) octave:78> omega omega = 0.043243 0.112456 0.199385 0.206074 0.316799 octave:79> plotsimple(xx+50*s(:,80),0,60,-15,21) octave:80> plotsimple(xx+20*s(:,80),0,60,-15,21) octave:81> plotsimple(xx+20*s(:,180),0,60,-15,21) octave:82> diary off