function lshapec(a) 
%LSHAPEC   A model for the L-shaped membrane with rounded corner. 
%   LSHAPEC(R) solves the eigenvalue problem on a domain with a rounded 
%   reentrant corner with radius R. 

% Copyright 1994-2003 The MathWorks, Inc. 
% $Revision: 1.9.4.1 $  $Date: 2003/11/18 03:11:21 $

if nargin==0, 
  a=0.5; 
end 
[pde_fig,ax]=pdeinit; 
pdetool('appl_cb',1); 
setappdata(pde_fig,'currparam',str2mat('1.0','0.0','0','1.0')); 
pdetool('snapon'); 
set(ax,'DataAspectRatio',[1 1 1]) 
set(ax,'PlotBoxAspectRatio',[1.5 1 1]) 
set(ax,'XLim',[-1.5 1.5]); 
set(ax,'YLim',[-1 1]); 
set(ax,'XTickMode','auto'); 
set(ax,'YTickMode','auto'); 

% Geometry description: 
% $Revision: 1.9.4.1 $ 
pdepoly([ -1,... 
 1,... 
 1,... 
 0,... 
 0,... 
 -1,... 
],... 
[ -1,... 
 -1,... 
 1,... 
 1,... 
 0,... 
 0,... 
],... 
 'P1'); 
pdecirc(-a,a,a,'C1'); 
pderect([-a 0 a 0],'SQ1'); 
set(findobj(get(pde_fig,'Children'),'Tag','PDEEval'),'String','P1+SQ1-C1') 

% Boundary conditions: 
pdetool('changemode',0) 
pdetool('removeb',[5 8 ]); 
pdesetbd(7,... 
'dir',... 
1,... 
'1',... 
'0') 
pdesetbd(6,... 
'dir',... 
1,... 
'1',... 
'0') 
pdesetbd(5,... 
'dir',... 
1,... 
'1',... 
'0') 
pdesetbd(4,... 
'dir',... 
1,... 
'1',... 
'0') 
pdesetbd(3,... 
'dir',... 
1,... 
'1',... 
'0') 
pdesetbd(2,... 
'dir',... 
1,... 
'1',... 
'0') 
pdesetbd(1,... 
'dir',... 
1,... 
'1',... 
'0') 

% Mesh generation: 
setappdata(pde_fig,'Hgrad',1.3); 
setappdata(pde_fig,'refinemethod','regular'); 
pdetool('initmesh') 
pdetool('refine') 
pdetool('jiggle') 

% PDE coefficients: 
pdeseteq(4,... 
'1.0',... 
'0.0',... 
'0',... 
'1.0',... 
'linspace(0,5,101)',... 
'atan(cos(pi/2*x))',... 
'3*sin(pi*x).*exp(sin(pi/2*y))',... 
'[0 100]') 
setappdata(pde_fig,'currparam',... 
['1.0';... 
'0.0';... 
'0  ';... 
'1.0']) 

% Solve parameters: 
setappdata(pde_fig,'solveparam',... 
str2mat('0','1608','10','pdeadworst',... 
'0.5','longest','0','1E-4','','fixed','Inf')) 

% Plotflags: 
setappdata(pde_fig,'plotflags',[1 1 1 1 1 1 1 1 0 0 0 1 0 1 0 0 0 1]); 
setappdata(pde_fig,'colstring',''); 
setappdata(pde_fig,'arrowstring',''); 
setappdata(pde_fig,'deformstring',''); 
setappdata(pde_fig,'heightstring',''); 

% Solve PDE: 
pdetool('solve') 