MAT 202, Lab #7 Key (My comments are in blue.) 1a. >> A=[1.71 -.707;1 0]; >> x0=[11;13]; >> x1=A*x0; >> x2=A*x1; >> x3=A*x2; >> x4=A*x3; >> x5=A*x4; >> x6=A*x5; >> x7=A*x6; >> x8=A*x7; >> x10=A^10*x0; >> x20=A^20*x0; >> PM=[x0 x1 x2 x3 x4 x5 x6 x7 x8 x10 x20]; >> X=PM(1,:); >> Y=PM(2,:); >> plot(X,Y) >> [xi,R]=eig(sym(A)) xi = [ 7/10, 101/100] [ 1, 1] R= [ 7/10, 0] [ 0, 101/100] >> x=linspace(0,12,51); >> y=1/(7/10)*x; >> hold on >> plot(x,y,’r’) >> y1=1/(101/100)*x; >> plot(x,y1,’g’) >> hold off >> 1b. >> A=[.4 .3;-.325 1.2]; >> x0=[11;13]; >> >> x1=A*x0; >> x2=A*x1; >> x3=A*x2; >> x4=A*x3; >> x5=A*x4; >> x6=A*x5; >> x7=A*x6; >> x8=A*x7; >> x10=A^10*x0; >> x20=A^20*x0; >> PM=[x0 x1 x2 x3 x4 x5 x6 x7 x8 x10 x20]; >> X=PM(1,:); >> Y=PM(2,:); >> plot(X,Y) >> [xi,R]=eig(sym(A)) xi = [ 2, 6/13] [ 1, 1] R= [ 11/20, 0] [ 0, 21/20] >> x=linspace(0,12,51); >> y=1/2*x; >> y1=13/6*x; >> hold on >> plot(x,y,'r') >> plot(x,y1,'g') >> hold off >> 1c. >> A=[1.7 -.3;-1.2 .8]; >> x1=A*x0; >> x2=A*x1; >> x3=A*x2; >> x4=A*x3; >> x5=A*x4; >> x6=A*x5; >> x7=A*x6; >> x8=A*x7; >> x10=A^10*x0; >> x20=A^20*x0; >> PM=[x0 x1 x2 x3 x4 x5 x6 x7 x8 x10 x20]; >> X=PM(1,:); >> Y=PM(2,:); >> plot(X,Y) >> [xi,R]=eig(sym(A)) xi = [ 1/4, -1] [ 1, 1] R= [ 1/2, 0] [ 0, 2] >> x=linspace(0,7*10^6,51); >> y=4*x; >> y1=-x; >> hold on >> plot(x,y,'r') >> plot(x,y1,'g') >> hold off >> 2. >> P=[.99 .08;.01 .92]; >> [xi,R]=eig(sym(P)) xi = [ -1, 8] [ 1, 1] R= [ 91/100, 0] [ 0, 1] >> P^1000 ans = 0.8889 0.8889 0.1111 0.1111 >> ans*9 ans = 8.0000 8.0000 1.0000 1.0000 >> This confirms that the steady state solution belongs to the eigenvalue 𝜆 = 1, and the equilibrium vectors is the corresponding eigenvector. 3a. >> P=[.9 .002 .12;.099 .95 .004;.001 .048 .876]; >> [xi,R]=eig(sym(P)) xi = [ 3004/2401, (4321^(1/2)*i)/47 - 35/47, - (4321^(1/2)*i)/47 - 35/47] [ 6140/2401, - (4321^(1/2)*i)/47 - 12/47, (4321^(1/2)*i)/47 - 12/47] [ 1, 1, 1] R= [ 1, 0, 0] [ 0, 863/1000 - (4321^(1/2)*i)/1000, 0] [ 0, 0, (4321^(1/2)*i)/1000 + 863/1000] >> P^1000 ans = 0.2602 0.2602 0.2602 0.5318 0.5318 0.5318 0.2080 0.2080 0.2080 >> 3b. >> P=[.7 0 0 .4;0 .5 .2 0;0 .5 .8 0;.3 0 0 .6]; >> [xi,R]=eig(sym(P)) xi = [ 0, -1, 0, 4/3] [ -1, 0, 2/5, 0] [ 1, 0, 1, 0] [ 0, 1, 0, 1] R= [ 3/10, 0, 0, 0] [ 0, 3/10, 0, 0] [ 0, 0, 1, 0] [ 0, 0, 0, 1] >> P^1000 ans = 0.5714 0 0 0.5714 0 0.2857 0.2857 0 0 0.7143 0.7143 0 0.4286 0 0 0.4286 >> This matrix has two equilibrium vectors. There is not sufficient communication between vectors. 3c. >> P=[.7 0 0 .4;.2 .5 .1 0;0 .5 .1 0;.1 0 .8 .6]; >> [xi,R]=eig(sym(P)) xi = [ 4/3, - (100*(1/(300*(7/250 - (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) + (7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3) - 3/10)^2)/29 - 1/(435*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) - (20*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3))/29 - 6/29, 1/(870*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) - (100*(1/(600*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) - (3^(1/2)*(1/(300*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) - (7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3))*i)/2 + (7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)/2 + 3/10)^2)/29 - (3^(1/2)*(1/(300*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) - (7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3))*10*i)/29 + (10*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3))/29 - 6/29, (3^(1/2)*(1/(300*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) - (7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3))*10*i)/29 - (100*((3^(1/2)*(1/(300*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) - (7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3))*i)/2 + 1/(600*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) + (7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)/2 + 3/10)^2)/29 + 1/(870*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) + (10*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3))/29 - 6/29] [ 3/5, (175*(1/(300*(7/250 - (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) + (7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3) - 3/10)^2)/58 + 43/(6960*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) + (215*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3))/116 - 103/232, (3^(1/2)*(1/(300*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) - (7/250 - (21167^(1/2)*27000000^(1/2))/27000000)^(1/3))*215*i)/232 + (175*(1/(600*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) - (3^(1/2)*(1/(300*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) - (7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3))*i)/2 + (7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)/2 + 3/10)^2)/58 - 43/(13920*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) - (215*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3))/232 - 103/232, - (3^(1/2)*(1/(300*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) - (7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3))*215*i)/232 + (175*((3^(1/2)*(1/(300*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) - (7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3))*i)/2 + 1/(600*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) + (7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)/2 + 3/10)^2)/58 - 43/(13920*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) - (215*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3))/232 - 103/232] [ 1/3, (25*(1/(300*(7/250 - (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) + (7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3) - 3/10)^2)/58 - 9/(2320*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) - (135*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3))/116 - 81/232, 9/(4640*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) + (25*(1/(600*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) - (3^(1/2)*(1/(300*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) - (7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3))*i)/2 + (7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)/2 + 3/10)^2)/58 - (3^(1/2)*(1/(300*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) - (7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3))*135*i)/232 + (135*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3))/232 - 81/232, (3^(1/2)*(1/(300*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) - (7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3))*135*i)/232 + (25*((3^(1/2)*(1/(300*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) - (7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3))*i)/2 + 1/(600*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) + (7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)/2 + 3/10)^2)/58 + 9/(4640*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) + (135*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3))/232 - 81/232] [ 1, 1, 1, 1] R= [ 1, 0, 0, 0] [ 0, 3/10 - (7/250 - (21167^(1/2)*27000000^(1/2))/27000000)^(1/3) - 1/(300*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)), 0, 0] [ 0, 0, 1/(600*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) - (3^(1/2)*(1/(300*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) - (7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3))*i)/2 + (7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)/2 + 3/10, 0] [ 0, 0, 0, (3^(1/2)*(1/(300*(7/250 - (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) - (7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3))*i)/2 + 1/(600*(7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)) + (7/250 (21167^(1/2)*27000000^(1/2))/27000000)^(1/3)/2 + 3/10] >> P^1000 ans = 0.4082 0.1837 0.1020 0.3061 0.4082 0.1837 0.1020 0.3061 0.4082 0.1837 0.1020 0.3061 0.4082 0.1837 0.1020 0.3061 >> double(xi) ans = 1.3333 0.6000 0.3333 1.0000 -0.5055 0.3064 -0.8009 1.0000 -0.5576 + 0.8835i -0.5576 - 0.8835i -0.3817 - 0.3683i -0.3817 + 0.3683i -0.0607 - 0.5152i -0.0607 + 0.5152i 1.0000 1.0000 >> double(R) ans = 1.0000 0 0 0 0 -0.0913 0 0 0 0 0 0 0.4956 - 0.3238i 0 0 0.4956 + 0.3238i >> This matrix does have sufficient communication. There is only one equilibrium vector. 3d. >> P=[.36 .09 0 .4;.2 .5 .2 .13;.25 .4 .8 0;.19 .01 0 .47]; >> [xi,R]=eig(sym(P)) xi = [ 11/5, 1942/9405 + 153884/(705375*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)) + (4960*((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3))/627 (2000*(1241/(45000*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)) + ((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3) + 113/300)^2)/627, 1942/9405 76942/(705375*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)) (2480*((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3))/627 (3^(1/2)*(1241/(45000*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)) ((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3))*2480*i)/627 (2000*(1241/(90000*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)) + ((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3)/2 + (3^(1/2)*(1241/(45000*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)) ((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3))*i)/2 - 113/300)^2)/627, 1942/9405 76942/(705375*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)) (2480*((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3))/627 + (3^(1/2)*(1241/(45000*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)) ((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3))*2480*i)/627 (2000*(1241/(90000*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)) + ((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3)/2 (3^(1/2)*(1241/(45000*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)) ((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3))*i)/2 - 113/300)^2)/627] [ 56/5, (2000*(1241/(45000*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)) + ((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3) + 113/300)^2)/33 103003/(74250*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)) (1660*((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3))/33 - 6562/495, (2000*(1241/(90000*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)) + ((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3)/2 + (3^(1/2)*(1241/(45000*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)) ((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3))*i)/2 - 113/300)^2)/33 + 103003/(148500*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)) + (830*((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3))/33 + (3^(1/2)*(1241/(45000*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)) ((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3))*830*i)/33 - 6562/495, (2000*(1241/(90000*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)) + ((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3)/2 (3^(1/2)*(1241/(45000*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)) ((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3))*i)/2 - 113/300)^2)/33 + 103003/(148500*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)) + (830*((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3))/33 (3^(1/2)*(1241/(45000*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)) ((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3))*830*i)/33 - 6562/495] [ 503/20, 37777/3135 + 549763/(470250*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)) + (8860*((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3))/209 (12000*(1241/(45000*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)) + ((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3) + 113/300)^2)/209, 37777/3135 549763/(940500*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)) (4430*((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3))/209 - (3^(1/2)*(1241/(45000*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)) ((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3))*4430*i)/209 (12000*(1241/(90000*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)) + ((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3)/2 + (3^(1/2)*(1241/(45000*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)) ((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3))*i)/2 - 113/300)^2)/209, 37777/3135 549763/(940500*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)) (4430*((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3))/209 + (3^(1/2)*(1241/(45000*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)) ((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3))*4430*i)/209 (12000*(1241/(90000*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)) + ((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3)/2 (3^(1/2)*(1241/(45000*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)) ((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3))*i)/2 - 113/300)^2)/209] [ 1, 1, 1, 1] R= [ 1, 0, 0, 0] [ 0, 1241/(45000*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)) + ((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3) + 113/300, 0, 0] [ 0, 0, 113/300 ((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3)/2 (3^(1/2)*(1241/(45000*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)) ((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3))*i)/2 1241/(90000*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)), 0] [ 0, 0, 0, 113/300 - ((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3)/2 + (3^(1/2)*(1241/(45000*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3)) ((138270839^(1/2)*i)/3000000 + 63953/27000000)^(1/3))*i)/2 1241/(90000*(138270839^(1/2)*(i/3000000) + 63953/27000000)^(1/3))] >> double(xi) ans = 2.2000 11.2000 25.1500 1.1648 + 0.0000i -1.8437 + 0.0000i -0.5871 - 0.0000i -0.1797 + 0.0000i 0.3970 - 0.0000i -4.1627 + 0.0000i -1.9851 0.4467 + 0.0000i 3.7499 - 0.0000i 1.0000 1.0000 1.0000 1.0000 >> double(R) ans = 1.0000 0 0 0 0 0 0 0.6895 + 0.0000i 0 0 0 0.1237 + 0.0000i 0 0 0 0.3168 - 0.0000i >> P^1000 ans = 0.0556 0.2832 0.6359 0.0253 0.0556 0.2832 0.6359 0.0253 0.0556 0.2832 0.6359 0.0253 0.0556 0.2832 0.6359 0.0253 >> 4a. >> syms x y x1 x2 t L >> syms a b >> ivp='Dx1=x1+2*x2,Dx2=3*x1+2*x2,x1(0)=a,x2(0)=b'; >> [x1,x2]=dsolve(ivp,'t'); >> x1f=@(t,a,b) eval(vectorize(x1)); >> x2f=@(t,a,b) eval(vectorize(x2)); >> figure; hold on >> t=-3:0.1:3; >> for a=-2:2 for b=-2:2 plot(x1f(t,a,b),x2f(t,a,b)) end end >> I had to zoom in a bit to see the graph. You can also adjust your graph by changing your t range. 4b. >> hold off >> ivp='Dx1=4*x1+7*x2,Dx2=-2*x1-5*x2,x1(0)=a,x2(0)=b'; >> [x1,x2]=dsolve(ivp,'t'); >> x1f=@(t,a,b) eval(vectorize(x1)); >> x2f=@(t,a,b) eval(vectorize(x2)); >> figure; hold on >> t=-2:0.1:2; >> for a=-2:2 for b=-2:2 plot(x1f(t,a,b),x2f(t,a,b)) end end 4c. >> hold off >> ivp='Dx1=2*x1+0*x2,Dx2=-1*x1-5*x2,x1(0)=6,x2(0)=1'; >> [x1,x2]=dsolve(ivp,'t'); >> x1f=@(t) eval(vectorize(x1)); >> x2f=@(t) eval(vectorize(x2)); >> t=-1:0.1:1; >> figure; hold on >> plot(x1f(t),x2f(t)) >> 4d. >> hold off >> ivp='Dx1=2*x1-x2,Dx2=3*x1-2*x2,x1(0)=a,x2(0)=b'; >> [x1,x2]=dsolve(ivp,'t'); >> x1f=@(t,a,b) eval(vectorize(x1)); >> x2f=@(t,a,b) eval(vectorize(x2)); >> figure; hold on >> t=-3:0.1:3; >> for a=-2:2 for b=-2:2 plot(x1f(t,a,b),x2f(t,a,b)) end end >> 4e. >> hold off >> ivp='Dx1=4*x1-3*x2,Dx2=8*x1-6*x2,x1(0)=2,x2(0)=-5'; >> [x1,x2]=dsolve(ivp,'t'); >> x1f=@(t) eval(vectorize(x1)); >> x2f=@(t) eval(vectorize(x2)); t=-1:0.1:1; >> figure; hold on >> plot(x1f(t),x2f(t)) The rest of the code here is just checking solutions, that they are reasonable and agree with eigenpairs approach. >> A=[1 2;3 2] A= 1 3 2 2 >> [xi,R]=eig(sym(A)) xi = [ -1, 2/3] [ 1, 1] R= [ -1, 0] [ 0, 4] >> A=[4 7;-2 -5]; >> [xi,R]=eig(sym(A)) xi = [ -1, -7/2] [ 1, 1] R= [ -3, 0] [ 0, 2] >> A=[2 0;-1 -5]; >> [xi,R]=eig(sym(A)) xi = [ 0, -7] [ 1, 1] R= [ -5, 0] [ 0, 2] >> A=[2 -1;3 -2]; >> [xi,R]=eig(sym(A)) xi = [ 1, 1/3] [ 1, 1] R= [ 1, 0] [ 0, -1] >> A=[4 -3;8 -6]; >> [xi,R]=eig(sym(A)) xi = [ 3/4, 1/2] [ 1, 1] R= [ 0, 0] [ 0, -2] >>
© Copyright 2025 Paperzz