clear all
m = 0.001;      %masa tega (kg)
r = 0.01;    % precnik tega (m)
l = 0.7;    % duzina kanapa (m)
g = 9.81;   % gravitacija m/s^2

mi = 1.827e-5;  % vazduh (kg/ms)
mi = 8.9e-4;    % voda

B=2*pi*r*mi;

tmax=5;

f=@(t,x) [x(2)/l; -g*sin(x(1))];              %bez otpora
%f=@(t,x) [x(2)/l; -B/m*x(2)-g*sin(x(1))];    %sa otporom

hold on
axis equal
for teta0=-3*pi:0.5:3*pi  %menjamo pocetni ugao
    for v0=-6:1:6  %menjamo pocetnu brzinu
        init=[teta0; v0];
        [t,x]=ode45(f,[0,tmax],init);
        odeset('RelTol', 1e-6);
        plot(x(:,1),x(:,2))
        pause
    end
    
end
