A = 2 5 -1 -1 -3 0 2 3 -2 syms L solve(poly(sym(A))) ans = [ -1] [ -1] [ -1] 3-rank((-1)*eye(3)-A) ans = 1 % Geom. nas. 1 < alg. nas. 3 => matice neni diagonalizovatelna % Numericky vypocet se falesne tvari, ze ano: [V,D]=eig(A) V = 0.8165 0.8165 -0.8165 -0.4082 + 0.0000i -0.4082 - 0.0000i 0.4082 0.4082 + 0.0000i 0.4082 - 0.0000i -0.4082 D = -1.0000 + 0.0000i 0 0 0 -1.0000 - 0.0000i 0 0 0 -1.0000 rank(V) ans = 3 format long [V,D]=eig(A) V = Columns 1 through 2 0.81649658092699 0.81649658092699 -0.40824801583891 + 0.00000047564972i -0.40824801583891 - 0.00000047564972i 0.40824856508956 + 0.00000047564716i 0.40824856508956 - 0.00000047564716i Column 3 -0.81649658092847 0.40824883971341 -0.40824774121210 D = Columns 1 through 2 -0.99999865462159 + 0.00000233020136i 0 0 -0.99999865462159 - 0.00000233020136i 0 0 Column 3 0 0 -1.00000269075682 % Symbolicky vypocet ale da spravnou odpoved: [V,D]=eig(sym(A)) V = [ 2] [ -1] [ 1] D = [ -1, 0, 0] [ 0, -1, 0] [ 0, 0, -1] % vlastni vektor je jediny, nebot % geometricka nasobnost je 1 diary off figure linspace(-2,2) ans = Columns 1 through 3 -2.00000000000000 -1.95959595959596 -1.91919191919192 Columns 4 through 6 -1.87878787878788 -1.83838383838384 -1.79797979797980 Columns 7 through 9 -1.75757575757576 -1.71717171717172 -1.67676767676768 Columns 10 through 12 -1.63636363636364 -1.59595959595960 -1.55555555555556 Columns 13 through 15 -1.51515151515152 -1.47474747474747 -1.43434343434343 Columns 16 through 18 -1.39393939393939 -1.35353535353535 -1.31313131313131 Columns 19 through 21 -1.27272727272727 -1.23232323232323 -1.19191919191919 Columns 22 through 24 -1.15151515151515 -1.11111111111111 -1.07070707070707 Columns 25 through 27 -1.03030303030303 -0.98989898989899 -0.94949494949495 Columns 28 through 30 -0.90909090909091 -0.86868686868687 -0.82828282828283 Columns 31 through 33 -0.78787878787879 -0.74747474747475 -0.70707070707071 Columns 34 through 36 -0.66666666666667 -0.62626262626263 -0.58585858585859 Columns 37 through 39 -0.54545454545455 -0.50505050505050 -0.46464646464646 Columns 40 through 42 -0.42424242424242 -0.38383838383838 -0.34343434343434 Columns 43 through 45 -0.30303030303030 -0.26262626262626 -0.22222222222222 Columns 46 through 48 -0.18181818181818 -0.14141414141414 -0.10101010101010 Columns 49 through 51 -0.06060606060606 -0.02020202020202 0.02020202020202 Columns 52 through 54 0.06060606060606 0.10101010101010 0.14141414141414 Columns 55 through 57 0.18181818181818 0.22222222222222 0.26262626262626 Columns 58 through 60 0.30303030303030 0.34343434343434 0.38383838383838 Columns 61 through 63 0.42424242424242 0.46464646464646 0.50505050505051 Columns 64 through 66 0.54545454545455 0.58585858585859 0.62626262626263 Columns 67 through 69 0.66666666666667 0.70707070707071 0.74747474747475 Columns 70 through 72 0.78787878787879 0.82828282828283 0.86868686868687 Columns 73 through 75 0.90909090909091 0.94949494949495 0.98989898989899 Columns 76 through 78 1.03030303030303 1.07070707070707 1.11111111111111 Columns 79 through 81 1.15151515151515 1.19191919191919 1.23232323232323 Columns 82 through 84 1.27272727272727 1.31313131313131 1.35353535353535 Columns 85 through 87 1.39393939393939 1.43434343434343 1.47474747474747 Columns 88 through 90 1.51515151515152 1.55555555555556 1.59595959595960 Columns 91 through 93 1.63636363636364 1.67676767676768 1.71717171717172 Columns 94 through 96 1.75757575757576 1.79797979797980 1.83838383838384 Columns 97 through 99 1.87878787878788 1.91919191919192 1.95959595959596 Column 100 2.00000000000000 plot(x,((x-1)./(x-2))) ??? Undefined function or variable 'x'. x=linspace(-2,2) x = Columns 1 through 3 -2.00000000000000 -1.95959595959596 -1.91919191919192 Columns 4 through 6 -1.87878787878788 -1.83838383838384 -1.79797979797980 Columns 7 through 9 -1.75757575757576 -1.71717171717172 -1.67676767676768 Columns 10 through 12 -1.63636363636364 -1.59595959595960 -1.55555555555556 Columns 13 through 15 -1.51515151515152 -1.47474747474747 -1.43434343434343 Columns 16 through 18 -1.39393939393939 -1.35353535353535 -1.31313131313131 Columns 19 through 21 -1.27272727272727 -1.23232323232323 -1.19191919191919 Columns 22 through 24 -1.15151515151515 -1.11111111111111 -1.07070707070707 Columns 25 through 27 -1.03030303030303 -0.98989898989899 -0.94949494949495 Columns 28 through 30 -0.90909090909091 -0.86868686868687 -0.82828282828283 Columns 31 through 33 -0.78787878787879 -0.74747474747475 -0.70707070707071 Columns 34 through 36 -0.66666666666667 -0.62626262626263 -0.58585858585859 Columns 37 through 39 -0.54545454545455 -0.50505050505050 -0.46464646464646 Columns 40 through 42 -0.42424242424242 -0.38383838383838 -0.34343434343434 Columns 43 through 45 -0.30303030303030 -0.26262626262626 -0.22222222222222 Columns 46 through 48 -0.18181818181818 -0.14141414141414 -0.10101010101010 Columns 49 through 51 -0.06060606060606 -0.02020202020202 0.02020202020202 Columns 52 through 54 0.06060606060606 0.10101010101010 0.14141414141414 Columns 55 through 57 0.18181818181818 0.22222222222222 0.26262626262626 Columns 58 through 60 0.30303030303030 0.34343434343434 0.38383838383838 Columns 61 through 63 0.42424242424242 0.46464646464646 0.50505050505051 Columns 64 through 66 0.54545454545455 0.58585858585859 0.62626262626263 Columns 67 through 69 0.66666666666667 0.70707070707071 0.74747474747475 Columns 70 through 72 0.78787878787879 0.82828282828283 0.86868686868687 Columns 73 through 75 0.90909090909091 0.94949494949495 0.98989898989899 Columns 76 through 78 1.03030303030303 1.07070707070707 1.11111111111111 Columns 79 through 81 1.15151515151515 1.19191919191919 1.23232323232323 Columns 82 through 84 1.27272727272727 1.31313131313131 1.35353535353535 Columns 85 through 87 1.39393939393939 1.43434343434343 1.47474747474747 Columns 88 through 90 1.51515151515152 1.55555555555556 1.59595959595960 Columns 91 through 93 1.63636363636364 1.67676767676768 1.71717171717172 Columns 94 through 96 1.75757575757576 1.79797979797980 1.83838383838384 Columns 97 through 99 1.87878787878788 1.91919191919192 1.95959595959596 Column 100 2.00000000000000 plot(x,((x-1)./(x-2))) Warning: Divide by zero. y=(x-1)./(x-2); Warning: Divide by zero. y(end) ans = Inf y(end)=NaN y = Columns 1 through 3 0.75000000000000 0.74744897959184 0.74484536082474 Columns 4 through 6 0.74218750000000 0.73947368421053 0.73670212765957 Columns 7 through 9 0.73387096774194 0.73097826086957 0.72802197802198 Columns 10 through 12 0.72500000000000 0.72191011235955 0.71875000000000 Columns 13 through 15 0.71551724137931 0.71220930232558 0.70882352941176 Columns 16 through 18 0.70535714285714 0.70180722891566 0.69817073170732 Columns 19 through 21 0.69444444444444 0.69062500000000 0.68670886075949 Columns 22 through 24 0.68269230769231 0.67857142857143 0.67434210526316 Columns 25 through 27 0.67000000000000 0.66554054054054 0.66095890410959 Columns 28 through 30 0.65625000000000 0.65140845070423 0.64642857142857 Columns 31 through 33 0.64130434782609 0.63602941176471 0.63059701492537 Columns 34 through 36 0.62500000000000 0.61923076923077 0.61328125000000 Columns 37 through 39 0.60714285714286 0.60080645161290 0.59426229508197 Columns 40 through 42 0.58750000000000 0.58050847457627 0.57327586206897 Columns 43 through 45 0.56578947368421 0.55803571428571 0.55000000000000 Columns 46 through 48 0.54166666666667 0.53301886792453 0.52403846153846 Columns 49 through 51 0.51470588235294 0.50500000000000 0.49489795918367 Columns 52 through 54 0.48437500000000 0.47340425531915 0.46195652173913 Columns 55 through 57 0.45000000000000 0.43750000000000 0.42441860465116 Columns 58 through 60 0.41071428571429 0.39634146341463 0.38125000000000 Columns 61 through 63 0.36538461538462 0.34868421052632 0.33108108108108 Columns 64 through 66 0.31250000000000 0.29285714285714 0.27205882352941 Columns 67 through 69 0.25000000000000 0.22656250000000 0.20161290322581 Columns 70 through 72 0.17500000000000 0.14655172413793 0.11607142857143 Columns 73 through 75 0.08333333333333 0.04807692307692 0.01000000000000 Columns 76 through 78 -0.03125000000000 -0.07608695652174 -0.12500000000000 Columns 79 through 81 -0.17857142857143 -0.23750000000000 -0.30263157894737 Columns 82 through 84 -0.37500000000000 -0.45588235294118 -0.54687500000000 Columns 85 through 87 -0.65000000000000 -0.76785714285714 -0.90384615384615 Columns 88 through 90 -1.06250000000000 -1.25000000000000 -1.47500000000000 Columns 91 through 93 -1.75000000000000 -2.09375000000000 -2.53571428571429 Columns 94 through 96 -3.12500000000000 -3.95000000000000 -5.18749999999999 Columns 97 through 99 -7.25000000000001 -11.37499999999999 -23.75000000000011 Column 100 NaN plot(x,y) xp=linspaee(2,5) ??? Undefined function or variable 'linspaee'. xp=linspace(2,5) xp = Columns 1 through 3 2.00000000000000 2.03030303030303 2.06060606060606 Columns 4 through 6 2.09090909090909 2.12121212121212 2.15151515151515 Columns 7 through 9 2.18181818181818 2.21212121212121 2.24242424242424 Columns 10 through 12 2.27272727272727 2.30303030303030 2.33333333333333 Columns 13 through 15 2.36363636363636 2.39393939393939 2.42424242424242 Columns 16 through 18 2.45454545454545 2.48484848484848 2.51515151515152 Columns 19 through 21 2.54545454545455 2.57575757575758 2.60606060606061 Columns 22 through 24 2.63636363636364 2.66666666666667 2.69696969696970 Columns 25 through 27 2.72727272727273 2.75757575757576 2.78787878787879 Columns 28 through 30 2.81818181818182 2.84848484848485 2.87878787878788 Columns 31 through 33 2.90909090909091 2.93939393939394 2.96969696969697 Columns 34 through 36 3.00000000000000 3.03030303030303 3.06060606060606 Columns 37 through 39 3.09090909090909 3.12121212121212 3.15151515151515 Columns 40 through 42 3.18181818181818 3.21212121212121 3.24242424242424 Columns 43 through 45 3.27272727272727 3.30303030303030 3.33333333333333 Columns 46 through 48 3.36363636363636 3.39393939393939 3.42424242424242 Columns 49 through 51 3.45454545454545 3.48484848484848 3.51515151515152 Columns 52 through 54 3.54545454545455 3.57575757575758 3.60606060606061 Columns 55 through 57 3.63636363636364 3.66666666666667 3.69696969696970 Columns 58 through 60 3.72727272727273 3.75757575757576 3.78787878787879 Columns 61 through 63 3.81818181818182 3.84848484848485 3.87878787878788 Columns 64 through 66 3.90909090909091 3.93939393939394 3.96969696969697 Columns 67 through 69 4.00000000000000 4.03030303030303 4.06060606060606 Columns 70 through 72 4.09090909090909 4.12121212121212 4.15151515151515 Columns 73 through 75 4.18181818181818 4.21212121212121 4.24242424242424 Columns 76 through 78 4.27272727272727 4.30303030303030 4.33333333333333 Columns 79 through 81 4.36363636363636 4.39393939393939 4.42424242424242 Columns 82 through 84 4.45454545454546 4.48484848484848 4.51515151515152 Columns 85 through 87 4.54545454545455 4.57575757575758 4.60606060606061 Columns 88 through 90 4.63636363636364 4.66666666666667 4.69696969696970 Columns 91 through 93 4.72727272727273 4.75757575757576 4.78787878787879 Columns 94 through 96 4.81818181818182 4.84848484848485 4.87878787878788 Columns 97 through 99 4.90909090909091 4.93939393939394 4.96969696969697 Column 100 5.00000000000000 xp(1)=NaN xp = Columns 1 through 3 NaN 2.03030303030303 2.06060606060606 Columns 4 through 6 2.09090909090909 2.12121212121212 2.15151515151515 Columns 7 through 9 2.18181818181818 2.21212121212121 2.24242424242424 Columns 10 through 12 2.27272727272727 2.30303030303030 2.33333333333333 Columns 13 through 15 2.36363636363636 2.39393939393939 2.42424242424242 Columns 16 through 18 2.45454545454545 2.48484848484848 2.51515151515152 Columns 19 through 21 2.54545454545455 2.57575757575758 2.60606060606061 Columns 22 through 24 2.63636363636364 2.66666666666667 2.69696969696970 Columns 25 through 27 2.72727272727273 2.75757575757576 2.78787878787879 Columns 28 through 30 2.81818181818182 2.84848484848485 2.87878787878788 Columns 31 through 33 2.90909090909091 2.93939393939394 2.96969696969697 Columns 34 through 36 3.00000000000000 3.03030303030303 3.06060606060606 Columns 37 through 39 3.09090909090909 3.12121212121212 3.15151515151515 Columns 40 through 42 3.18181818181818 3.21212121212121 3.24242424242424 Columns 43 through 45 3.27272727272727 3.30303030303030 3.33333333333333 Columns 46 through 48 3.36363636363636 3.39393939393939 3.42424242424242 Columns 49 through 51 3.45454545454545 3.48484848484848 3.51515151515152 Columns 52 through 54 3.54545454545455 3.57575757575758 3.60606060606061 Columns 55 through 57 3.63636363636364 3.66666666666667 3.69696969696970 Columns 58 through 60 3.72727272727273 3.75757575757576 3.78787878787879 Columns 61 through 63 3.81818181818182 3.84848484848485 3.87878787878788 Columns 64 through 66 3.90909090909091 3.93939393939394 3.96969696969697 Columns 67 through 69 4.00000000000000 4.03030303030303 4.06060606060606 Columns 70 through 72 4.09090909090909 4.12121212121212 4.15151515151515 Columns 73 through 75 4.18181818181818 4.21212121212121 4.24242424242424 Columns 76 through 78 4.27272727272727 4.30303030303030 4.33333333333333 Columns 79 through 81 4.36363636363636 4.39393939393939 4.42424242424242 Columns 82 through 84 4.45454545454546 4.48484848484848 4.51515151515152 Columns 85 through 87 4.54545454545455 4.57575757575758 4.60606060606061 Columns 88 through 90 4.63636363636364 4.66666666666667 4.69696969696970 Columns 91 through 93 4.72727272727273 4.75757575757576 4.78787878787879 Columns 94 through 96 4.81818181818182 4.84848484848485 4.87878787878788 Columns 97 through 99 4.90909090909091 4.93939393939394 4.96969696969697 Column 100 5.00000000000000 x=[x,xp(2:end)] x = Columns 1 through 3 -2.00000000000000 -1.95959595959596 -1.91919191919192 Columns 4 through 6 -1.87878787878788 -1.83838383838384 -1.79797979797980 Columns 7 through 9 -1.75757575757576 -1.71717171717172 -1.67676767676768 Columns 10 through 12 -1.63636363636364 -1.59595959595960 -1.55555555555556 Columns 13 through 15 -1.51515151515152 -1.47474747474747 -1.43434343434343 Columns 16 through 18 -1.39393939393939 -1.35353535353535 -1.31313131313131 Columns 19 through 21 -1.27272727272727 -1.23232323232323 -1.19191919191919 Columns 22 through 24 -1.15151515151515 -1.11111111111111 -1.07070707070707 Columns 25 through 27 -1.03030303030303 -0.98989898989899 -0.94949494949495 Columns 28 through 30 -0.90909090909091 -0.86868686868687 -0.82828282828283 Columns 31 through 33 -0.78787878787879 -0.74747474747475 -0.70707070707071 Columns 34 through 36 -0.66666666666667 -0.62626262626263 -0.58585858585859 Columns 37 through 39 -0.54545454545455 -0.50505050505050 -0.46464646464646 Columns 40 through 42 -0.42424242424242 -0.38383838383838 -0.34343434343434 Columns 43 through 45 -0.30303030303030 -0.26262626262626 -0.22222222222222 Columns 46 through 48 -0.18181818181818 -0.14141414141414 -0.10101010101010 Columns 49 through 51 -0.06060606060606 -0.02020202020202 0.02020202020202 Columns 52 through 54 0.06060606060606 0.10101010101010 0.14141414141414 Columns 55 through 57 0.18181818181818 0.22222222222222 0.26262626262626 Columns 58 through 60 0.30303030303030 0.34343434343434 0.38383838383838 Columns 61 through 63 0.42424242424242 0.46464646464646 0.50505050505051 Columns 64 through 66 0.54545454545455 0.58585858585859 0.62626262626263 Columns 67 through 69 0.66666666666667 0.70707070707071 0.74747474747475 Columns 70 through 72 0.78787878787879 0.82828282828283 0.86868686868687 Columns 73 through 75 0.90909090909091 0.94949494949495 0.98989898989899 Columns 76 through 78 1.03030303030303 1.07070707070707 1.11111111111111 Columns 79 through 81 1.15151515151515 1.19191919191919 1.23232323232323 Columns 82 through 84 1.27272727272727 1.31313131313131 1.35353535353535 Columns 85 through 87 1.39393939393939 1.43434343434343 1.47474747474747 Columns 88 through 90 1.51515151515152 1.55555555555556 1.59595959595960 Columns 91 through 93 1.63636363636364 1.67676767676768 1.71717171717172 Columns 94 through 96 1.75757575757576 1.79797979797980 1.83838383838384 Columns 97 through 99 1.87878787878788 1.91919191919192 1.95959595959596 Columns 100 through 102 2.00000000000000 2.03030303030303 2.06060606060606 Columns 103 through 105 2.09090909090909 2.12121212121212 2.15151515151515 Columns 106 through 108 2.18181818181818 2.21212121212121 2.24242424242424 Columns 109 through 111 2.27272727272727 2.30303030303030 2.33333333333333 Columns 112 through 114 2.36363636363636 2.39393939393939 2.42424242424242 Columns 115 through 117 2.45454545454545 2.48484848484848 2.51515151515152 Columns 118 through 120 2.54545454545455 2.57575757575758 2.60606060606061 Columns 121 through 123 2.63636363636364 2.66666666666667 2.69696969696970 Columns 124 through 126 2.72727272727273 2.75757575757576 2.78787878787879 Columns 127 through 129 2.81818181818182 2.84848484848485 2.87878787878788 Columns 130 through 132 2.90909090909091 2.93939393939394 2.96969696969697 Columns 133 through 135 3.00000000000000 3.03030303030303 3.06060606060606 Columns 136 through 138 3.09090909090909 3.12121212121212 3.15151515151515 Columns 139 through 141 3.18181818181818 3.21212121212121 3.24242424242424 Columns 142 through 144 3.27272727272727 3.30303030303030 3.33333333333333 Columns 145 through 147 3.36363636363636 3.39393939393939 3.42424242424242 Columns 148 through 150 3.45454545454545 3.48484848484848 3.51515151515152 Columns 151 through 153 3.54545454545455 3.57575757575758 3.60606060606061 Columns 154 through 156 3.63636363636364 3.66666666666667 3.69696969696970 Columns 157 through 159 3.72727272727273 3.75757575757576 3.78787878787879 Columns 160 through 162 3.81818181818182 3.84848484848485 3.87878787878788 Columns 163 through 165 3.90909090909091 3.93939393939394 3.96969696969697 Columns 166 through 168 4.00000000000000 4.03030303030303 4.06060606060606 Columns 169 through 171 4.09090909090909 4.12121212121212 4.15151515151515 Columns 172 through 174 4.18181818181818 4.21212121212121 4.24242424242424 Columns 175 through 177 4.27272727272727 4.30303030303030 4.33333333333333 Columns 178 through 180 4.36363636363636 4.39393939393939 4.42424242424242 Columns 181 through 183 4.45454545454546 4.48484848484848 4.51515151515152 Columns 184 through 186 4.54545454545455 4.57575757575758 4.60606060606061 Columns 187 through 189 4.63636363636364 4.66666666666667 4.69696969696970 Columns 190 through 192 4.72727272727273 4.75757575757576 4.78787878787879 Columns 193 through 195 4.81818181818182 4.84848484848485 4.87878787878788 Columns 196 through 198 4.90909090909091 4.93939393939394 4.96969696969697 Column 199 5.00000000000000 y=[y,yp(2:end)] ??? Undefined function or variable 'yp'. y=[y,(xp-1)./(xp-2)]; plot(x,y) ??? Error using ==> plot Vectors must be the same lengths. x(1) ans = -2 x(end) ans = 5 y=(x-1)./(x-2); Warning: Divide by zero. I=find(x==0) I = [] I=find(isnan(x)) I = [] x=-2:5; x=linspace(-2,5); x=linspace(-5,5,101); I=find(x==0) I = 51 x(I)=NaN; y=(x-1)./(x-2); Warning: Divide by zero. x=linspace(-5,5,101); I=find(x==2) I = 71 x(I)=NaN; y=(x-1)./(x-2); y(I) ans = NaN plot(x,y) x=linspace(-5,5,101); y=-(x<1)+(x>1); plot(x,y) y=-(x<0)+(x>0); plot(x,y) ax=axis ax = -5 5 -1 1 ax(3:4)=[-1.2,1.2] ax = Columns 1 through 3 -5.00000000000000 5.00000000000000 -1.20000000000000 Column 4 1.20000000000000 axis(ax) help flor flor.m not found. help floor FLOOR Round towards minus infinity. FLOOR(X) rounds the elements of X to the nearest integers towards minus infinity. See also ROUND, CEIL, FIX. y=floor(x); plot(x,y) grid x=linspace(-10,10,101); y1=abs(x-1); y2=2-abs(x); x=x.'; y1=abs(x-1); y2=2-abs(x); Y=[y1,y2]; plot(x,Y) grid y1=abs(floor(x)); y2=floor(abs(x)); plot(x,[y1,y2]) diary off