$$\hspace{3cm}\frac{d^2\theta}{d\tau ^2}+\frac{g}{l}\,\mbox{sen}\, \theta=0 \hspace{.5cm} ,\hspace{.5cm} \theta(0)=\theta_0 \hspace{.5cm} ,\hspace{.5cm} \frac{d\theta}{d\tau}(0)=0\hspace{3cm}$$
donde se ha llamado
|
|
f=@(t,x) [x(2); -sin(x(1))];
vt=linspace(0,10,50);
[t,xest1]=ode45(f,vt,[pi/8 0]);
[t,xest2]=ode45(f,vt,[pi/4 0]);
[t,xest3]=ode45(f,vt,[pi/2 0]);
figure(1)
plot(t,xest1(:,1),t,xest2(:,1),t,xest3(:,1))
legend('theta_0=pi/8','theta_0=pi/4','theta_0=pi/2')
xlabel('t');ylabel('ángulo theta')
grid on
figure(2)
plot(t,xest1(:,2),t,xest2(:,2),t,xest3(:,2))
legend('theta_0=pi/8','theta_0=pi/4','theta_0=pi/2')
xlabel('t');ylabel('velocidad')
grid on
Ejecuntando estas líneas obtendremos en la figura 1 las gráficas de las aproximaciones del ángulo (el cuadro con la leyenda se ha movido posteriormente):

