// Diagrama de fase

deff('[xprima] = ej2(t,x)','xprima = [-1 0;0 4]*x') 
clf
t = 0:0.1:10
xf = linspace(-4,4,10);yf = linspace(-4,4,6)

for i = 1:length(xf)
       x = ode([xf(i);0.1],0,t,ej2)
    plot2d(x(1,:),x(2,:),rect = [-4 -4 4 4])
            x = ode([xf(i);-0.1],0,t,ej2)
    plot2d(x(1,:),x(2,:),rect = [-4 -4 4 4])
end
            x = ode([xf(1);0],0,t,ej2)
    plot2d(x(1,:),x(2,:),rect = [-4 -4 4 4])
                x = ode([xf($);0],0,t,ej2)
    plot2d(x(1,:),x(2,:),rect = [-4 -4 4 4])
                x = ode([0.01;0.01],0,t,ej2)
    plot2d(x(1,:),x(2,:),rect = [-4 -4 4 4])
                x = ode([-0.01;-0.01],0,t,ej2)
    plot2d(x(1,:),x(2,:),rect = [-4 -4 4 4])
fchamp(ej2,0,xf,yf)
xlabel('x1');ylabel('x2')

