function rb4=zeichnen
R=15.9;
r=10.9;
E_w=58;
s=25;
fb=20;

w=pi/180;
epsilon=E_w*w;
sigma=s*w;
bf=fb/2*w;
%%%%
axis equal;
axis square;
hold on;

xlabel('x');
ylabel('y');
axis([-R-4 R+4 -R-4 R+4]); %erst X Koordi -> dann Y

%Rahmen
x=0;
y=0;

%Gitter nur zur übersicht bei gelegenheit auskommentieren
plot([-R-10 R+10],[0 0],'k')
hold on;
plot([0 0],[-R-10 R+10],'k')
hold on;

    %für die Radien
    v=0:0.01:2*pi;
    %Innenradius
    plot(r*cos(v)+x,r*sin(v)+y,'g')
    hold on;
    %Außenradius
    plot(R*cos(v)+x,R*sin(v)+y,'g')
    hold on;
%%%%
%nullter Gitterpunkt/ Anfangspunkt
x0=cos(-sigma)*R;
y0=sin(-sigma)*R;
plot(x0,y0,'r+')
hold on;

%--------------------------------------------------------------------------

% berührt innenradius ??
if (sin(epsilon)*R<=r)
    rb4=1; %für Innenreflexion
else
    rb4=2; %für Asussenreflexion
end

%--------------------------------------------------------------------------

if rb4==1
    %für Außenreflexion
    alpha=asin((R/r)*sin(epsilon));
    zeta=alpha-epsilon;
    for t=0:1:12
        if (t*(2*zeta)<sigma+bf+pi)
            xa=cos(t*(2*zeta)-sigma)*R;
            ya=sin(t*(2*zeta)-sigma)*R;
            xi=cos(t*(2*zeta)+zeta-sigma)*r;
            yi=sin(t*(2*zeta)+zeta-sigma)*r;
            plot([xa xi],[ya yi],'b')
            hold on;
            xb=cos((t+1)*(2*zeta)-sigma)*R;
            yb=sin((t+1)*(2*zeta)-sigma)*R;
            plot([xi xb],[yi yb],'b')
            hold on;
            plot(xa,ya,'r+')
            hold on;
            plot(xi,yi,'r+')
            hold on;
            xb=cos((t+1)*(2*zeta)-sigma)*R;
            yb=sin((t+1)*(2*zeta)-sigma)*R;
            plot(xb,yb,'r+')
            hold on;
        end
    end 
elseif rb4==2
    %für Außenreflexion
    for t=0:1:12
        if (t*(pi-2*epsilon)<pi+bf+sigma)
            xa=cos(t*(pi-2*epsilon)-sigma)*R;
            ya=sin(t*(pi-2*epsilon)-sigma)*R;
            xb=cos((t+1)*(pi-2*epsilon)-sigma)*R;
            yb=sin((t+1)*(pi-2*epsilon)-sigma)*R;
            plot([xa xb],[ya yb],'b')
            hold on;
            plot(xb,yb,'r+')
            hold on;
        end
    end
end
print( '-djpeg', '-r300', ['c:\Dokumente und Einstellungen\Ben\Desktop\studienarbeit\Beispiel Vergleich' 'e45s25'])



