% Kyvadlo
% Parametry
g = 9.81;      % gravitacni zrychleni (m/s^2)
L = 1.0;       % delka kyvadla (m)
fi0 = pi/4; % pocatecni vychylka (radiany)
tspan = [0,10];% celkovy cas simulace simulation (0 to 10 seconds)
pocatecni_podminky = [fi0, 0]; % Initial conditions [theta, theta_dot]

% Define the differential equation
pendulumODE = @(t, y) [y(2); -g/L*sin(y(1))];

% Solve the differential equation using ODE45
[t, fi] = ode45(pendulumODE, tspan, pocatecni_podminky);

% Convert theta to degrees for plotting
fi_deg = rad2deg(fi);

