function graphit(x,A,endtime) %Linear system plotter. %This function provides graphs of all of the variables in the vector, x(t) %which is the solution to dx/dt=Ax. %x is an nx1 vector of initial conditions of the x vector. %A in an nxn matrix of constant coefficient. %endtime is the size of the time (horizotal) axis. %The graphs will then appear in a separate window. %All of the xi's will be separately plotted (in different colors) vs. time. [M,D]=eig(A); t=sym('t'); z=exp(diag(D)*t); x0=x; y0=inv(M)*x0; y=y0.*z; x=M*y; m=zeros(101,1); k=zeros(101,length(x)); m(1)=0; k(1,:)=x0'; n=2; while n<=101; p=0.01*(endtime)*(n-1); m(n)=p; k(n,:)=double(subs(x,'t',p)'); n=n+1; end; plot(m,k)