Home > p2plib > plotbra.m

plotbra

PURPOSE ^

plot branch, with diverse optional arguments

SYNOPSIS ^

function plotbra(p,wnr,cmp,varargin)

DESCRIPTION ^

 plot branch, with diverse optional arguments 
 For aux arguments see below. 
 Note that p.branch(:,i)=[count;ineg;lam;err;user(1);user(2);....]
 i.e. user(cmp) at position 4+cmp

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function plotbra(p,wnr,cmp,varargin)
0002 % plot branch, with diverse optional arguments
0003 % For aux arguments see below.
0004 % Note that p.branch(:,i)=[count;ineg;lam;err;user(1);user(2);....]
0005 % i.e. user(cmp) at position 4+cmp
0006 pp=p.branch(4+cmp,:); 
0007 noa=nargin-3; % number of opt arguments
0008 figure(wnr); hold on; 
0009 if(noa==0); plot(p.branch(3,:),pp); return; end 
0010 % standard values for varargin:
0011 ms=5;rms=0;lms=5; % marker sizes for: bif-points, reg.points, label-points
0012 inc=1; nl=0;  % inc for markers, length of label list, offsets for labels
0013 ox=0; oy=0; fs=16; cl='black'; %offsets for labels, fontsize, color
0014 fp=1; lp=size(p.branch,2); % first and last point
0015 lwst=4; lwun=2;  tyun='-'; tyst='-'; % line-widths and types stable and unstable
0016 k=1;  % scan varargin:
0017 while k<=noa 
0018     switch lower(varargin{k})
0019       case 'lwun'; lwun=varargin{k+1}; k=k+2; % Linewidth of unstable Sol.
0020       case 'lwst'; lwst=varargin{k+1}; k=k+2; % Linewidth of stable Sol.
0021       case 'lw';   lwst=varargin{k+1}; lwun=lwst/2; k=k+2;
0022       case 'tyun'; tyun=varargin{k+1}; k=k+2; % Linetype of unstable Sol.
0023       case 'tyst'; tyst=varargin{k+1}; k=k+2; % Linetype of stable Sol.
0024       case 'ms';   ms=varargin{k+1}; k=k+2; % Markersize (bif.points)
0025       case 'rms';  rms=varargin{k+1}; k=k+2; % Markersize (reg. points)
0026       case 'inc';  inc=varargin{k+1}; k=k+2; % increment
0027       case 'lab';  la=varargin{k+1}; nl=length(la); k=k+2; % label-list
0028       case 'labi'; bralen=size(p.branch,2); % labels with increment
0029                    la=p.branch(1,1):varargin{k+1}:p.branch(1,bralen); 
0030                    nl=size(la); nl=nl(2); k=k+2; 
0031       case 'labo'; ox=varargin{k+1};oy=varargin{k+2}; k=k+3; % label offsets
0032       case 'fs';   fs=varargin{k+1}; k=k+2; % fontsize for labels
0033       case 'fp';   fp=varargin{k+1}; k=k+2; % first point
0034       case 'lp';   lp=varargin{k+1}; k=k+2; % last point
0035       case 'cl';   cl=varargin{k+1}; k=k+2; % color
0036       otherwise;   break; 
0037     end 
0038 end 
0039 for i=fp:lp-1 % loop from first-point to last point
0040     if (p.branch(2,i)==0 && p.branch(2,i+1)~=0) % stability change from stable to unstable
0041       if size(p.bifvals,2)>0
0042         if isempty(intersect(p.bifvals(1,:),i))==0 % stable point is bifpoint
0043           plot(p.branch(3,i:i+1),pp(i:i+1),tyun,'Linewidth',lwun,'color',cl);
0044         elseif isempty(intersect(p.bifvals(1,:),i+1))==0 %  unstable point is bifpoint
0045           plot(p.branch(3,i:i+1),pp(i:i+1),tyst,'Linewidth',lwst,'color',cl);
0046         else plot(p.branch(3,i:i+1),pp(i:i+1),tyun,'Linewidth',lwun,'color',cl); % no one is bifpoint
0047         end %isempty(intersect(p.bifvals(1,:),i))==0
0048       end %size(p.bifvals,2)>0 % stable point is bifpoint
0049     else plot(p.branch(3,i:i+1),pp(i:i+1),tyun,'Linewidth',lwun,'color',cl);
0050     end  %stability change from stable to unstable
0051     if (p.branch(2,i)~=0 && p.branch(2,i+1)==0) %stability change from unstable to stable
0052       if size(p.bifvals,2)>0
0053         if isempty(intersect(p.bifvals(1,:),i))==0 % unstable point is bifpoint
0054           plot(p.branch(3,i:i+1),pp(i:i+1),tyst,'Linewidth',lwst,'color',cl);
0055         elseif isempty(intersect(p.bifvals(1,:),i+1))==0 %  stable point ist bifpoint
0056           plot(p.branch(3,i:i+1),pp(i:i+1),tyun,'Linewidth',lwun,'color',cl);
0057         else plot(p.branch(3,i:i+1),pp(i:i+1),tyun,'Linewidth',lwun,'color',cl);
0058         end %isempty(intersect(p.bifvals(1,:),i))==0
0059       end %size(p.bifvals,2)>0 % stable point is bifpoint
0060     else plot(p.branch(3,i:i+1),pp(i:i+1),tyun,'Linewidth',lwun,'color',cl);
0061     end  %stability change from unstable to stable
0062     % plot between points of the same stability
0063     if (p.branch(2,i)==0 && p.branch(2,i+1)==0) 
0064         plot(p.branch(3,i:i+1),pp(i:i+1),tyst,'Linewidth',lwst,'color',cl);end
0065     if (p.branch(2,i)~=0 && p.branch(2,i+1)~=0) 
0066         plot(p.branch(3,i:i+1),pp(i:i+1),tyun,'Linewidth',lwun,'color',cl); end
0067 end 
0068 if(ms>0) % plot markers for bif-points
0069   for i=1:size(p.bifvals,2)
0070       if (p.bifvals(1,i)>=fp && p.bifvals(1,i)<=lp) 
0071         plot(p.bifvals(4,i),p.bifvals(5+cmp,i),'o','MarkerSize',ms,'color',cl); 
0072       end
0073   end
0074 end
0075 if(rms>0) % plot markers for regular points
0076   for i=fp:inc:lp
0077     if (p.branch(2,i)==0) plot(p.branch(3,i),pp(i),'*','MarkerSize',rms,'color',cl);
0078     else plot(p.branch(3,i),pp(i),'+','MarkerSize',rms,'color',cl); % unstable point
0079     end
0080   end
0081 end
0082 for k=1:nl; % plot labels
0083     if (la(k)>=fp && la(k)<=lp) 
0084       ls=mat2str(la(k)); x=p.branch(3,la(k))+ox; y=pp(la(k))+oy;
0085       text(x,y,ls,'FontSize',fs,'color',cl);
0086       xx=p.branch(3,la(k)); yy=pp(la(k));
0087       plot(xx,yy,'.','MarkerSize',lms*lwst,'color',cl);
0088     end
0089 end 
0090 axis tight;box on; set(gca,'FontSize',fs);

Generated on Wed 15-Aug-2012 10:09:15 by m2html © 2005