clear all close all xini = -2; yini = 0; alfa = 1; dt = 0.001; x(1)=xini; y(1)=yini; i=2; for t=dt:dt:50 x(i) = x(i-1) + dt * y(i-1); y(i) = y(i-1) - dt * x(i-1); i=i+1; end t=0:dt:50; figure; FS=18; set(gcf,'Color','w'); % color del background set(gcf,'Position',[10 351 1000 400]); subplot(1,2,1) plot (y,x,'g') % Grafico del diagrama de fases xlabel('y','FontSize',FS) ylabel('x','FontSize',FS) axis([-1.5*max(x) 1.5*max(x) -1.5*max(y) 1.5*max(y)]) % Extender los ejes para tener un marco de referencia set(gca,'FontSize',FS); subplot(1,2,2) plot(t,x,t,y) % Grafico de la evolucion temporal h = legend('x(t)','y(t)'); ylabel('x(t); y(t)','FontSize',FS) xlabel('t','FontSize',FS) set(gca,'FontSize',FS);