function Lab4 clear all; close all; clc; t=-2:0.2:2; s=-10:0.2:4; % you might need to use a different interval for s to make the solution fit in the plotting window you are considering % Finding the eigenvalues and eigenvectors of a matrix % the columns of V are the eigenvectors of A, corresponding to eigenvalues % in the diagonal of D A=[[4,1];[1,4]] [V,D]=eig(A) figure [x,y]=meshgrid(-2:.2:2,-2:.2:2); % make sure to change the coefficients of the system dx= 4*x+y; dy= x+4*y; dyu=0.5*dy./sqrt(dy.^2+dx.^2); dxu=0.5*dx./sqrt(dy.^2+dx.^2); % plotting the direction field corresponding to the linear system quiver(x,y,dxu,dyu) xlabel('x') ylabel('y') hold on % plot the line solutions corresponding to the eigenvectos plot(t,t,'LineWidth',2) hold on plot(-t,t,'LineWidth',2) hold on % plot another particular solution plot(-0.5*exp(3*s/10)+0.1*exp(5*s/10),0.5*exp(3*s/10)+0.1*exp(5*s/10),'LineWidth',2) end