function[]=demo_fixp;
% function[]=demo_fixp;
% Demonstrace pevneho bodu
%

NIT=30; % pocet iteraci
hlist=[];

mainfighndl=figure( ...
	'Visible','on', ...
	'Tag','IterMat', ...
	'Name','Demo - lin. eq - iterations', ...
        'NumberTitle','off',...
	'UserData',[]);

axes( ...
        'Units','normalized', ...
        'Position',[0.08 0.08 0.7 0.87]);

% The CONSOLE frame
    uicontrol( ...
        'Style','frame', ...
        'Units','normalized', ...
        'FontUnits','normalized',...
        'Position',[0.8,0,.19,1], ...
        'BackgroundColor',[0.750 0.750 0.750]);

% 1.rovnice        
  R1HndlTxt=uicontrol( ...
        'Style','text', ...
        'Units','normalized', ...
        'FontUnits','normalized',...
        'Position',[0.82,.92,.15,0.05], ...
        'String','Equation 1.', ...
        'BackgroundColor',[0.750 0.750 0.750]);


   R11hndl=uicontrol( ...
	'Style','edit', ...
        'Units','normalized', ...
        'String','2',...%
        'BackgroundColor',[1 1 1], ...
	'Tag','a11', ...
        'Position',[.81,.88,.04,.045], ...
        'HorizontalAlignment','center');
     

  R12Hndl=uicontrol( ...
        'Style','text', ...
        'Units','normalized', ...
        'FontUnits','normalized',...
        'Position',[0.85,.88,.03,0.045], ...
        'String','x+', ...
        'BackgroundColor',[0.750 0.750 0.750]);

   R113ndl=uicontrol( ...
	'Style','edit', ...
        'Units','normalized', ...
        'String','1',...%
        'BackgroundColor',[1 1 1], ...
	'Tag','a12', ...
        'Position',[.88,.88,.04,.045], ...
        'HorizontalAlignment','center');
     

  R14Hndl=uicontrol( ...
        'Style','text', ...
        'Units','normalized', ...
	'Tag','R1HndlTxt', ...
        'FontUnits','normalized',...
        'Position',[0.92,.88,.03,0.045], ...
        'String','y=', ...
        'BackgroundColor',[0.750 0.750 0.750]);

   R115ndl=uicontrol( ...
	'Style','edit', ...
        'Units','normalized', ...
        'String','3',...%
        'BackgroundColor',[1 1 1], ...
	'Tag','b1', ...
        'Position',[.945,.88,.04,.045], ...
        'HorizontalAlignment','center');
     


% 2.rovnice        
  R2HndlTxt=uicontrol( ...
        'Style','text', ...
        'Units','normalized', ...
	'Tag','R1HndlTxt', ...
        'FontUnits','normalized',...
        'Position',[0.82,.82,.15,0.05], ...
        'String','Equation 2', ...
        'BackgroundColor',[0.750 0.750 0.750]);


   R21hndl=uicontrol( ...
	'Style','edit', ...
        'Units','normalized', ...
        'String','1',...%
        'BackgroundColor',[1 1 1], ...
	'Tag','a21', ...
        'Position',[.81,.78,.04,.045], ...
        'HorizontalAlignment','center');
     

  R22Hndl=uicontrol( ...
        'Style','text', ...
        'Units','normalized', ...
	'Tag','R1HndlTxt', ...
        'FontUnits','normalized',...
        'Position',[0.85,.78,.03,0.045], ...
        'String','x+', ...
        'BackgroundColor',[0.750 0.750 0.750]);

  R23ndl=uicontrol( ...
	'Style','edit', ...
        'Units','normalized', ...
        'String','2',...%
        'BackgroundColor',[1 1 1], ...
	'Tag','a22', ...
        'Position',[.88,.78,.04,.045], ...
        'HorizontalAlignment','center');
     

  R24Hndl=uicontrol( ...
        'Style','text', ...
        'Units','normalized', ...
	'Tag','R1HndlTxt', ...
        'FontUnits','normalized',...
        'Position',[0.92,.78,.03,0.045], ...
        'String','y=', ...
        'BackgroundColor',[0.750 0.750 0.750]);

  R25ndl=uicontrol( ...
	'Style','edit', ...
        'Units','normalized', ...
        'String','3',...%
        'BackgroundColor',[1 1 1], ...
	'Tag','b2', ...
        'Position',[.945,.78,.04,.045], ...
        'HorizontalAlignment','center');

% meze zobrazeni
  MezeHndlTxt=uicontrol( ...
        'Style','text', ...
        'Units','normalized', ...
	'Tag','R1HndlTxt', ...
        'FontUnits','normalized',...
        'Position',[0.82,.72,.15,0.05], ...
        'String','Meze zobrazeni', ...
        'BackgroundColor',[0.750 0.750 0.750]);

  Mx1Hndl=uicontrol( ...
        'Style','text', ...
        'Units','normalized', ...
	'Tag','R1HndlTxt', ...
        'FontUnits','normalized',...
        'Position',[0.83,.68,.05,0.045], ...
        'String','x:', ...
        'BackgroundColor',[0.750 0.750 0.750]);

  Mx2ndl=uicontrol( ...
	'Style','edit', ...
        'Units','normalized', ...
        'String','-5',...%
        'BackgroundColor',[1 1 1], ...
        'UserData',0.1,...
	'Tag','x1', ...
        'Position',[.89,.68,.04,.045], ...
        'HorizontalAlignment','center');
     
  Mx4ndl=uicontrol( ...
	'Style','edit', ...
        'Units','normalized', ...
        'String','5',...%
        'BackgroundColor',[1 1 1], ...
        'UserData',0.1,...
	'Tag','x2', ...
        'Position',[.93,.68,.04,.045], ...
        'HorizontalAlignment','center');

  My1Hndl=uicontrol( ...
        'Style','text', ...
        'Units','normalized', ...
	'Tag','R1HndlTxt', ...
        'FontUnits','normalized',...
        'Position',[0.83,.64,.05,0.045], ...
        'String','y:', ...
        'BackgroundColor',[0.750 0.750 0.750]);

  My2ndl=uicontrol( ...
	'Style','edit', ...
        'Units','normalized', ...
        'String','-5',...%
        'BackgroundColor',[1 1 1], ...
        'UserData',0.1,...
	'Tag','y1', ...
        'Position',[.89,.64,.04,.045], ...
        'HorizontalAlignment','center');
     

  My4ndl=uicontrol( ...
	'Style','edit', ...
        'Units','normalized', ...
        'String','5',...%
        'BackgroundColor',[1 1 1], ...
        'UserData',0.1,...
	'Tag','y2', ...
        'Position',[.93,.64,.04,.045], ...
        'HorizontalAlignment','center');


% Zobrazit
  ZobrazStr1='mainh=findobj(''Tag'',''IterMat''); ud=get(mainh,''UserData''); A=ud.A;b=ud.b; ome=ud.ome;  a11h=findobj(''Tag'',''a11''); a11s=get(a11h,''String''); A(1,1)=eval(a11s);  a12h=findobj(''Tag'',''a12''); a12s=get(a12h,''String''); A(1,2)=eval(a12s);';
  ZobrazStr2='a21h=findobj(''Tag'',''a21''); a21s=get(a21h,''String''); A(2,1)=eval(a21s);  a22h=findobj(''Tag'',''a22''); a22s=get(a22h,''String''); A(2,2)=eval(a22s);  b1h=findobj(''Tag'',''b1''); b1s=get(b1h,''String''); b(1)=eval(b1s);  b2h=findobj(''Tag'',''b2''); b2s=get(b2h,''String''); b(2)=eval(b2s); ud.A=A; ud.b=b;';
  ZobrazStr3='x1h=findobj(''Tag'',''x1''); x1s=get(x1h,''String''); x1=eval(x1s);  x2h=findobj(''Tag'',''x2''); x2s=get(x2h,''String''); x2=eval(x2s); y1h=findobj(''Tag'',''y1''); y1s=get(y1h,''String''); y1=eval(y1s);  y2h=findobj(''Tag'',''y2''); y2s=get(y2h,''String''); y2=eval(y2s);';
  ZobrazStr4='a11=A(1,1);a12=A(1,2);a21=A(2,1);a22=A(2,2);b1=b(1);b2=b(2);';
  ZobrazStr5='x11=x1; x12=x2; if a12==0, x11=b1/a11; x12=x11; y11=y1; y12=y2; else, y11=(b1-a11*x11)/a12; y12=(b1-a11*x12)/a12; end; figure(mainh); plot([x11,x12],[y11,y12],''b''); hold on;';
  ZobrazStr6='x21=x1; x22=x2; if a22==0, x21=b1/a21; x22=x21; y21=y1; y22=y2; else, y21=(b2-a21*x21)/a22; y22=(b2-a21*x22)/a22; end; plot([x21,x22],[y21,y22],''g'');';
  ZobrazStr7='x0h=findobj(''Tag'',''x0''); y0h=findobj(''Tag'',''y0''); x0s=get(x0h,''String''); x0=eval(x0s); y0s=get(y0h,''String''); y0=eval(y0s); plot(x0,y0,''r*''); hold off;axis([x1,x2,y1,y2]);';
  ZobrazStr8='ud.x0=x0;ud.y0=y0;set(mainh,''UserData'',ud);';
  ZobrazHndl=uicontrol( ...
        'Style','push', ...
        'Units','normalized', ...
        'FontUnits','normalized',...
        'Position',[0.81,.50,0.17,0.05], ...
	'Tag','Zobrazit', ...
        'String','Redraw', ...
        'UserData',0, ...
        'Enable','on',...
        'Callback',[ZobrazStr1,ZobrazStr2,ZobrazStr3,ZobrazStr4,ZobrazStr5,ZobrazStr6,ZobrazStr7,ZobrazStr8]);
hlist=[hlist,ZobrazHndl];

% Prohodit
  VymenStr1='mainh=findobj(''Tag'',''IterMat''); ud=get(mainh,''UserData''); A=ud.A;b=ud.b; ome=ud.ome;  a11h=findobj(''Tag'',''a11''); a11s=get(a11h,''String''); A(2,1)=eval(a11s);  a12h=findobj(''Tag'',''a12''); a12s=get(a12h,''String''); A(2,2)=eval(a12s);';
  VymenStr2='a21h=findobj(''Tag'',''a21''); a21s=get(a21h,''String''); A(1,1)=eval(a21s);  a22h=findobj(''Tag'',''a22''); a22s=get(a22h,''String''); A(1,2)=eval(a22s);  b1h=findobj(''Tag'',''b1''); b1s=get(b1h,''String''); b(2)=eval(b1s);  b2h=findobj(''Tag'',''b2''); b2s=get(b2h,''String''); b(1)=eval(b2s); ud.A=A; ud.b=b;';
  VymenStr3='x1h=findobj(''Tag'',''x1''); x1s=get(x1h,''String''); x1=eval(x1s);  x2h=findobj(''Tag'',''x2''); x2s=get(x2h,''String''); x2=eval(x2s); y1h=findobj(''Tag'',''y1''); y1s=get(y1h,''String''); y1=eval(y1s);  y2h=findobj(''Tag'',''y2''); y2s=get(y2h,''String''); y2=eval(y2s);';
  VymenStr4='a11=A(1,1);a12=A(1,2);a21=A(2,1);a22=A(2,2);b1=b(1);b2=b(2);set(a11h,''String'',num2str(a11));set(a12h,''String'',num2str(a12));set(a21h,''String'',num2str(a21));set(a22h,''String'',num2str(a22));set(b1h,''String'',num2str(b1));set(b2h,''String'',num2str(b2));set(mainh,''UserData'',ud);';
  VymenStr5='x11=x1; x12=x2; if a12==0, x11=b1/a11; x12=x11; y11=y1; y12=y2; else, y11=(b1-a11*x11)/a12; y12=(b1-a11*x12)/a12; end; plot([x11,x12],[y11,y12],''b''); hold on;';
  VymenStr6='x21=x1; x22=x2; if a22==0, x21=b1/a21; x22=x21; y21=y1; y22=y2; else, y21=(b2-a21*x21)/a22; y22=(b2-a21*x22)/a22; end; plot([x21,x22],[y21,y22],''g'');';
  VymenStr7='x0h=findobj(''Tag'',''x0''); y0h=findobj(''Tag'',''y0''); x0s=get(x0h,''String''); x0=eval(x0s); y0s=get(y0h,''String''); y0=eval(y0s); plot(x0,y0,''r*''); hold off;axis([x1,x2,y1,y2]);';
  VymenHndl=uicontrol( ...
        'Style','push', ...
        'Units','normalized', ...
        'FontUnits','normalized',...
        'Position',[0.81,.45,0.17,0.05], ...
	'Tag','ChangeHndl', ...
        'String','Exchange eq.', ...
        'UserData',0, ...
        'Enable','on',...
        'Callback',[VymenStr1,VymenStr2,VymenStr3,VymenStr4,VymenStr5,VymenStr6,VymenStr7]);
hlist=[hlist,VymenHndl];

% Pocatecni iterace
  MezeHndlTxt=uicontrol( ...
        'Style','text', ...
        'Units','normalized', ...
	'Tag','R1HndlTxt', ...
        'FontUnits','normalized',...
        'Position',[0.82,.59,.15,0.05], ...
        'String','Init. iter.', ...
        'BackgroundColor',[0.750 0.750 0.750]);

  Mx1Hndl=uicontrol( ...
        'Style','text', ...
        'Units','normalized', ...
	'Tag','R1HndlTxt', ...
        'FontUnits','normalized',...
        'Position',[0.82,.56,.03,0.045], ...
        'String','x0', ...
        'BackgroundColor',[0.750 0.750 0.750]);

  Mx2ndl=uicontrol( ...
	'Style','edit', ...
        'Units','normalized', ...
        'String','0',...
        'BackgroundColor',[1 1 1], ...
        'UserData',0.1,...
	'Tag','x0', ...
        'Position',[.85,.56,.04,.045], ...
        'HorizontalAlignment','center');
     

  Mx3Hndl=uicontrol( ...
        'Style','text', ...
        'Units','normalized', ...
	'Tag','R1HndlTxt', ...
        'FontUnits','normalized',...
        'Position',[0.9,.56,.03,0.045], ...
        'String','y0', ...
        'BackgroundColor',[0.750 0.750 0.750]);

  Mx4ndl=uicontrol( ...
	'Style','edit', ...
        'Units','normalized', ...
        'String','0',...
        'BackgroundColor',[1 1 1], ...
        'UserData',0.1,...
	'Tag','y0', ...
        'Position',[.93,.56,.04,.045], ...
        'HorizontalAlignment','center');

     
% Jacobiova metoda
  MezeHndlTxt=uicontrol( ...
        'Style','text', ...
        'Units','normalized', ...
	'Tag','Jacobi', ...
        'FontUnits','normalized',...
        'Position',[0.82,.39,.15,0.05], ...
        'String','Jacobi method', ...
        'BackgroundColor',[0.750 0.750 0.750]);

% Spustit
  RunJac1='mainh=findobj(''Tag'',''IterMat''); ud=get(mainh,''UserData''); NIT=ud.NIT; A=ud.A;b=ud.b; ome=ud.ome; a11=A(1,1); a12=A(1,2); a21=A(2,1); a22=A(2,2); b1=b(1);b2=b(2);xn=ud.x0;yn=ud.y0;';
  RunJac2='stoph=findobj(''Tag'',''StopJac'');zastav=get(stoph,''UserData'');nit=0;figure(mainh);hold on;hl=ud.hlist;nhl=length(hl);for ii=1:nhl, set(hl(ii),''Enable'',''Off'');end;set(stoph,''Enable'',''On'');';
  RunJac3='while nit<=NIT && ~zastav, xs=xn;ys=yn; xn=(b1-a12*ys)/a11;yn=(b2-a21*xs)/a22;[xn,yn], plot([xs,xn,xn,xs,xs],[ys,ys,yn,yn,ys],''r:'');plot(xn,yn,''r*'');pause(1);zastav=get(stoph,''UserData'');end;set(stoph,''UserData'',0);hold off;for ii=1:nhl, set(hl(ii),''Enable'',''On'');end;';
  RunJacHndl=uicontrol( ...
        'Style','push', ...
        'Units','normalized', ...
        'FontUnits','normalized',...
        'Position',[0.81,.35,0.08,0.05], ...
	'Tag','RunJac', ...
        'String','Run', ...
        'UserData',0, ...
        'Enable','on',...
        'Callback',[RunJac1,RunJac2,RunJac3]);
hlist=[hlist,RunJacHndl];        
    
% Zastavit
  StopStr1='set(gcbo,''UserData'',1); ';
  StopJacHndl=uicontrol( ...
        'Style','push', ...
        'Units','normalized', ...
        'FontUnits','normalized',...
        'Position',[0.90,.35,0.08,0.05], ...
	'Tag','StopJac', ...
        'String','Stop', ...
        'UserData',0, ...
        'Enable','on',...
        'Callback',StopStr1);
hlist=[hlist,StopJacHndl];

% GS metoda
  MezeHndlTxt=uicontrol( ...
        'Style','text', ...
        'Units','normalized', ...
	'Tag','GS', ...
        'FontUnits','normalized',...
        'Position',[0.82,.29,.15,0.05], ...
        'String','G-S method', ...
        'BackgroundColor',[0.750 0.750 0.750]);

% Spustit
  RunGS1='mainh=findobj(''Tag'',''IterMat''); ud=get(mainh,''UserData''); NIT=ud.NIT; A=ud.A;b=ud.b; ome=ud.ome; a11=A(1,1); a12=A(1,2); a21=A(2,1); a22=A(2,2); b1=b(1);b2=b(2);xn=ud.x0;yn=ud.y0;';
  RunGS2='stoph=findobj(''Tag'',''StopGS'');zastav=get(stoph,''UserData'');nit=0;figure(mainh);hold on;hl=ud.hlist;nhl=length(hl);for ii=1:nhl, set(hl(ii),''Enable'',''Off'');end;set(stoph,''Enable'',''On'');';
  RunGS3='while nit<=NIT && ~zastav, xs=xn;ys=yn; xn=(b1-a12*ys)/a11;yn=(b2-a21*xn)/a22;[xn,yn], plot([xs,xn,xn],[ys,ys,yn],''r:'');plot(xn,yn,''r*'');pause(1);zastav=get(stoph,''UserData'');end;set(stoph,''UserData'',0);hold off;for ii=1:nhl, set(hl(ii),''Enable'',''On'');end;';
  RunGSHndl=uicontrol( ...
        'Style','push', ...
        'Units','normalized', ...
        'FontUnits','normalized',...
        'Position',[0.81,.26,0.08,0.05], ...
	'Tag','RunGS', ...
        'String','Run', ...
        'UserData',0, ...
        'Enable','on',...
        'Callback',[RunGS1,RunGS2,RunGS3]);
hlist=[hlist,RunGSHndl];

% Zastavit
  StopGSHndl=uicontrol( ...
        'Style','push', ...
        'Units','normalized', ...
        'FontUnits','normalized',...
        'Position',[0.90,.26,0.08,0.05], ...
	'Tag','StopGS', ...
        'String','Stop', ...
        'UserData',0, ...
        'Enable','on',...
        'Callback',StopStr1);
hlist=[hlist,StopGSHndl];    
     
% Relaxacni metoda
  MezeHndlTxt=uicontrol( ...
        'Style','text', ...
        'Units','normalized', ...
	'Tag','R1HndlTxt', ...
        'FontUnits','normalized',...
        'Position',[0.82,.20,.15,0.05], ...
        'String','Relax. method', ...
        'BackgroundColor',[0.750 0.750 0.750]);

  MezeHndlTxt=uicontrol( ...
        'Style','text', ...
        'Units','normalized', ...
	'Tag','R1HndlTxt', ...
        'FontUnits','normalized',...
        'Position',[0.82,.16,.09,0.05], ...
        'String','Relax. par.', ...
        'BackgroundColor',[0.750 0.750 0.750]);

  MezeHndlTxt=uicontrol( ...
        'Style','Edit', ...
        'Units','normalized', ...
	'Tag','RelPar', ...
        'Position',[0.92,.16,.06,0.05], ...
        'String','1', ...
        'BackgroundColor',[1 1 1], ...
        'HorizontalAlignment','center');

% Spustit
  RunRel1='mainh=findobj(''Tag'',''IterMat''); ud=get(mainh,''UserData''); NIT=ud.NIT; A=ud.A;b=ud.b; a11=A(1,1); a12=A(1,2); a21=A(2,1); a22=A(2,2); b1=b(1);b2=b(2);xn=ud.x0;yn=ud.y0;';
  RunRel2='parh=findobj(''Tag'',''RelPar''); omes=get(parh,''String''); ome=eval(omes);ud.ome=ome; set(mainh,''UserData'',ud); stoph=findobj(''Tag'',''StopRel'');zastav=get(stoph,''UserData'');nit=0;figure(mainh);hold on;hl=ud.hlist;nhl=length(hl);for ii=1:nhl, set(hl(ii),''Enable'',''Off'');end;set(stoph,''Enable'',''On'');';
  RunRel3='while nit<=NIT && ~zastav, xs=xn;ys=yn; xn=(1-ome)*xs+ome*(b1-a12*ys)/a11;yn=(1-ome)*ys+ome*(b2-a21*xn)/a22;[xn,yn], plot([xs,xn,xn],[ys,ys,yn],''r:'');plot(xn,yn,''r*'');pause(1);zastav=get(stoph,''UserData'');end;set(stoph,''UserData'',0);hold off;for ii=1:nhl, set(hl(ii),''Enable'',''On'');end;';
  RunRelHndl=uicontrol( ...
        'Style','push', ...
        'Units','normalized', ...
        'FontUnits','normalized',...
        'Position',[0.81,.12,0.08,0.05], ...
	'Tag','RunRel', ...
        'String','Run', ...
        'UserData',0, ...
        'Enable','on',...
        'Callback',[RunRel1,RunRel2,RunRel3]);
hlist=[hlist,RunRelHndl];

% Zastavit
  StopRelHndl=uicontrol( ...
        'Style','push', ...
        'Units','normalized', ...
        'FontUnits','normalized',...
        'Position',[0.90,.12,0.08,0.05], ...
	'Tag','StopRel', ...
        'String','Stop', ...
        'UserData',0, ...
        'Enable','on',...
        'Callback',StopStr1);
hlist=[hlist,StopRelHndl];    
     

% button Konec
       closeStr='set(gcf,''CloseRequestFcn'',''closereq'');delete(gcf);';
       KonecHndl=uicontrol('Style','push','Units','normalized', ...
          'FontUnits','normalized',...
          'Position',[0.81,.01,.17,0.07], ...
          'Callback',closeStr, ...
          'BackgroundColor',[.5,0.5,0.5], ...
          'String','End');
hlist=[hlist,KonecHndl];

A=zeros(2,2);b=zeros(2,1);ome=1;
ud=struct('A',A,'b',b,'ome',ome,'x0',0,'y0',0,'NIT',NIT,'hlist',hlist);
set(mainfighndl,'UserData',ud);

set(gcf,'Units','normalized','Position',[0.1 0.15 0.8 0.7]);

eval([ZobrazStr1,ZobrazStr2,ZobrazStr3,ZobrazStr4,ZobrazStr5,ZobrazStr6,ZobrazStr7,ZobrazStr8]);

if 0
mainh=findobj('Tag','IterMat'); ud=get(mainh,'UserData'); A=ud.A;b=ud.b; ome=ud.ome;  a11h=findobj('Tag','a11'); a11s=get(a11h,'String'); A(1,1)=eval(a11s);  a12h=findobj('Tag','a12'); a12s=get(a12h,'String'); A(1,2)=eval(a12s);
a21h=findobj('Tag','a21'); a21s=get(a21h,'String'); A(2,1)=eval(a21s);  a22h=findobj('Tag','a22'); a22s=get(a22h,'String'); A(2,2)=eval(a22s);  b1h=findobj('Tag','b1'); b1s=get(b1h,'String'); b(1)=eval(b1s);  b2h=findobj('Tag','b2'); b2s=get(b2h,'String'); b(2)=eval(b2s); ud.A=A; ud.b=b;
x1h=findobj('Tag','x1'); x1s=get(x1h,'String'); x1=eval(x1s);  x2h=findobj('Tag','x2'); x2s=get(x2h,'String'); x2=eval(x2s); y1h=findobj('Tag','y1'); y1s=get(y1h,'String'); y1=eval(y1s);  y2h=findobj('Tag','y2'); y2s=get(y2h,'String'); y2=eval(y2s);
a11=A(1,1);a12=A(1,2);a21=A(2,1);a22=A(2,2);b1=b(1);b2=b(2);set(mainh,'UserData',ud);
x11=x1; x12=x2; if a12==0, x11=b1/a11; x12=x11; y11=y1; y12=y2; else, y11=(b1-a11*x11)/a12; y12=(b1-a11*x12)/a12; end; figure(mainh); plot([x11,x12],[y11,y12],'b'); hold on;
x21=x1; x22=x2; if a22==0, x21=b1/a21; x22=x21; y21=y1; y22=y2; else, y21=(b2-a21*x21)/a22; y22=(b2-a21*x22)/a22; end; plot([x21,x22],[y21,y22],'g');
x0h=findobj('Tag','x0'); y0h=findobj('Tag','y0'); x0s=get(x0h,'String'); x0=eval(x0s); y0s=get(y0h,'String'); y0=eval(y0s); plot(x0,y0,'r*'); hold off;axis([x1,x2,y1,y2]);
end

end %function
