Case of complex (nonreal) eigenvalues
, 
Example: consider the ODE system 
A = sym([4 5;-4 0])
A =

Find the eigenvalues: solve the characteristic equation
This gives the eigenvalues
. Note that
. r = eig(A) % find eigenvalues of A
r =

Find the eigenvectors: For each eigenvalue r find
with 
[V,D] = eig(A) % find matrix V with eigenvectors, diagonal matrix D with eigenvalues
V =

D =

For
we get the eigenvector
. This gives the complex solution For
we get the eigenvector
. This gives the complex solution RECIPE: Find a fundamental set
of real solutions
- Pick a complex solution

- Let

- Let

Here we have
and
. This gives the fundamental set of solutions syms y(t) [2 1] % define vector valued function y(t) = [y1(t);y2(t)]
sol = dsolve( diff(y)==A*y ); % find general solution
ysol = simplify( subs(y(t),sol) ) % in y(t) substitute the values from sol
ysol =

Y1 = subs(ysol,{C1,C2},{1,0})
Y1 =

Y2 = subs(ysol,{C1,C2},{0,1})
Y2 =

Plot vector field and trajectories in the phase plane
You need to download the file vectorfield.m and put it in the directory where your mlx files are. f = @(t,y) A*y; % define function f(t,y) for vectorfield
vectorfield(f,-20:2:20,-20:2:20); hold on
fplot(Y1(1),Y1(2),[-2,2],'b'); % plot trajectory for Y1 in blue
fplot(Y2(1),Y2(2),[-2,2],'k'); % plot trajectory for Y2 in black
fplot(-Y1(1),-Y1(2),[-2,2],'b:'); % plot trajectory for -Y1 in blue, dotted
fplot(-Y2(1),-Y2(2),[-2,2],'k:'); hold off; % plot trajectory for -Y2 in black, dotted
axis equal; axis([-20 20 -20 20]); xlabel('y_1'); ylabel('y_2')
title('four trajectories in the phase plane')