// Diagrama de fase

A = [-1 -1;4 1] 
deff('f = ej4s(x)','f = A*x')
x0 = [1;1]
xs = fsolve(x0,ej4s)

deff('xprima = ej4(t,x)','xprima = A*x') 
clf
xf = linspace(-8,8,8);yf = linspace(-8,8,6)
fchamp(ej4,0,xf,yf)
xlabel('x1');ylabel('x2')

[R,V] = spec(A);disp(R,'vectores propios =  ');disp([V(1,1);V(2,2)],'valores propios =  ')

if imag(V(1,1)) == 0 & imag(V(2,2)) == 0 then
    if R(1,1) <> 0 & R(1,2) <> 0 then
pend1 = R(2,1)/R(1,1);y1 = xs(2) + pend1*(xf-xs(1))
pend2 = R(2,2)/R(1,2);y2 = xs(2) + pend2*(xf-xs(1))
plot2d(xf',[y1' y2'],rect=[-8 -8 8 8]);
end
end

plot2d(xs(1),xs(2),-5)

t = 0:0.1:10
for i = 1:16
[b,x10,x20] = xclick()
       x = ode([x10;x20],0,t,ej4)
    plot2d(x(1,:),x(2,:),rect = [-8 -8 8 8])
 end



