The plot represents the ration between the period an oscillator and the approximated value obtained for small angles. According to the relative article on wikipedia, the oscillation period for small angles is given by:
while the actual period for any angle is given by:
where:
so the ratio is given by:
and this is the function plotted in the graph. First, with the following Matlab code I created a file called pendulum_period.dat:
res=1000; % resolution
phi=pi/2;
T=zeros(1,res); % initialization
for i=1:res
theta=i*pi/(2*res);
k = sin(theta)./2;
F = @(t) 1./sqrt(1-(k*sin(t)).^2);
T(i)=quad(F,0,phi);
end
T = 2.*T./pi; % normalization
angle=90*(1:res)./res; % to plot agains degrees
% saving in the external file
temp = [angle; T];
temp = temp';
save -ascii 'pendulum_period.dat' temp;
then, in order to plot it, I used the following Gnuplot code:
# set the output
set terminal svg
set output "pendulum_period.svg"
# axis properties
set yrange [0.99:1.08]
set xzeroaxis linetype -1 linewidth 0.5
set yzeroaxis linetype -1 linewidth 0.5
set xtics axis
set ytics axis
plot "pendulum_period.dat" using 1:2 with lines linewidth 2
This code creates a file called pendulum_period.svg. I heavily post-processed it with Inkscape.
|