function FlaecheRechteck

% http://geometrie.hs-nb.de/MATLAB-Programme/FlaecheRechteck.m   Bearbeitungsstand: 4.10.2004
% (C) Martin Nitschke, nitschke@hs-nb.de

clc;
close('all')
global ax
ax=[inf -inf inf -inf];
a=[11;0];
b=[0;7];
A=[0;0];
[X,Y]=meshgrid(0:a(1),0:b(2));
plot(X,Y,X',Y','color',0.5*[1 1 1],'linewidth',1.5);
hold('on')
Polygon([A A+a A+a+b A+b A],'k','linewidth',1.5,'erase','none')
hold('off')
Schrift(A+a/2,'\ita','HorizontalAlignment','center','VerticalAlignment','top');
Schrift(A+b/2,'\itb','HorizontalAlignment','center','VerticalAlignment','bottom','Rotation',90);
axis('equal')
axis(ax)
axis('off')
print('-depsc','FlaecheRechteck');

function Polygon(P,varargin);
global ax
plot(P(1,:),P(2,:),varargin{:})
if min(P(1,:))<ax(1)
  ax(1)=min(P(1,:));
end
if max(P(1,:))>ax(2)
  ax(2)=max(P(1,:));
end
if min(P(2,:))<ax(3)
  ax(3)=min(P(2,:));
end
if max(P(2,:))>ax(4)
  ax(4)=max(P(2,:));
end

function Schrift(P,txt,varargin)
text(P(1),P(2),txt,'FontName','TimesNewRoman','FontSize',50,varargin{:});
