function [] = seiltrick()
% Anfangs und Endzeitpunkt
t0 =   0.000;
dt =   0.001;
t1 =   6.000;

% Startwerte
phi0   = 0;
Omega0 = pi/4;

[T,Phi] = ode113(@myFun,[t0:dt:t1],[phi0 Omega0]);
Phi(:,1) = mod(90+180*Phi(:,1)/pi, 360);
Phi(:,2) = 180*Phi(:,2)/pi;

figure; plot(T, Phi(:,1)); grid on; ylim([0 360]);

end


function dY = myFun(t,Y)
% Konstanten
    g  = 9.81;
    m  = 1.00;
    l  = 0.50;
    r  = 0.25; % entspricht 1/2 * l
    b  = 0.05;
    JS = m*(l*l+b*b)/12;
    JA = JS+m*r*r;
    
    a     = 0.12;
    omega = 2*pi*4;

% Nichtlineare DGL
    dY = zeros(2,1);
    dY(1) = Y(2);
    dY(2) = ((m*r)*(g - a*omega*omega*cos(omega*t))/JA) * sin(Y(1));
end


