%  solvexcf3dfunddompic.m  
%  This script solves for trajectories of 3d hom cross curvature flow  
tspan = [0 80];                    % time span  
%m0 = [.1  .1  .1 1  1  1    1.7 1.7 1.7 .7 ...
%    .1  .1  .1 1  1  1    1.7 1.7 1.7 .7;...
%      .3 1.3 1.9 .3 .3 1.7   1   1.7  .3 1.7...
%      -.3 -1.3 -1.7 -.3 -.3 -1.7   -1   -1.7  -.3 -1.7]; % initial condition
%m0=[0; ...
%    2];
xinit=0:.1:1;
yinit=-2:.1:1;
heis0 = [0; 0];
E20=[.5 1; .01 1 ];
E110=[0 0;...
      -.01 -2];
SU2seps0=[.01  1   .5  .9 1; ...
          .01 .2  .5 .9 1];
SU2oth0=[ .015 .015 .025; ...
          .01 .01 .01];
SL2maxsym0=[1;...
          -2 ];
SL2seps0=[ 1 .1 ;...
          -.5  -1 ];
             -2  -2  -2   -2   -.01 -.01];

SL2oth0=[ .01  .01  .01  .01     ...
                   .01 .01 .01 .01 .01 .01 .01 .01; ...
         -.2  -.4  -.6  -.8      ...
           -1 -1.2 -.8 -.9 -.95 -.97 -.93 .94];
N = length(xinit); M = length(yinit); x=[]; y=[];

N=length(SL2oth0);
for i=1:N
[t,m] = ode23s('xcf',tspan,SL2oth0(:,i));   % run ode23
x = m(:,1);       % x = col 1 of m, 
y = m(:,2);        %  y = col 2 of m
plot(x,y,'Color',[.9 0 0])
hold on
end
 
N=length(SU2oth0);
for i=1:N
[t,m] = ode45('xcf',tspan,SU2oth0(:,i));   % run ode23
x = m(:,1);       % x = col 1 of m, 
y = m(:,2);        %  y = col 2 of m
plot(x,y,'Color',[0 .9 0])
hold on
end

N=length(SU2seps0);
for i=1:N
[t,m] = ode45('xcf',tspan,SU2seps0(:,i));   % run ode23
x = m(:,1);       % x = col 1 of m, 
y = m(:,2);        %  y = col 2 of m
plot(x,y,'Color',[0 .7 0], 'LineWidth',2)
hold on
end
text(1.05,1.05,'p_4')

[t,m] = ode45('xcf',tspan, [1,1]);   % run ode23
x = m(:,1);       % x = col 1 of m, 
y = m(:,2);        %  y = col 2 of m
plot(x,y,'o', 'MarkerFaceColor','black','MarkerSize',6)
hold on

set(gca,'YTickLabel',{'-2','','','','','','1'})
xlabel('m2 = a2/a1'), ylabel('m3 = a3/a1')



title ('Phase Plane Plot')
