From: landon donovan on
I want to make a phase diagram for various initial conditions for the variables x and y for the system:
function dy = funcion11(t,y) %%PARA Y<0 Y X<0 x=y(1) y=y(2)
m1=-0.9;
m2=-0.9;
b1=0;
b2=0;
c1=0.5;
c2=0.5;
dy=zeros(2,1);
if y(1)>0
if y(2)>0
dy(1)=m1*y(1)+b1+c1;
dy(2)=m2*y(2)+b2+c2;
elseif y(2)<0
dy(1)=m1*y(1)+b1-c1;
dy(2)=m2*y(2)+b2+c2;
end
elseif y(1)<0
if y(2)>0
dy(1)=m1*y(1)+b1+c1;
dy(2)=m2*y(2)+b2-c2;
elseif y(2)<0
dy(1)=m1*y(1)+b1-c1;
dy(2)=m2*y(2)+b2-c2;
end
end
----------------------------

and the script goes like this:

clc;clear all;close all;
tinicial=0;
tfinal=80;
tspan=[tinicial tfinal];
for x0=-5:5;
for y0=-5:5;
yin=[x0;y0];
[t,y]=ode23tb(@funcion11,tspan,yin)
plot(y(:,1),y(:,2))
set(gca,'NextPlot','add')
if y0==4 && x0==-5
alfa=1;
end
end
end

But it get stuck when x0=-5 , y0=5; I dont know why, please someone help.