Question 4
Contents

[t,x] = ode23(@pendulum, [0,6*pi], [-1.5, 0]);
figure;
plot(t,x(:,1),'DisplayName','x');
hold on;
plot(t,x(:,2),'DisplayName','x''');
xlabel('t');
legend('Location','SouthEast');

[t,x] = ode23(@pendulum, [0,6*pi], [-3, 0]);
figure;
plot(t,x(:,1),'DisplayName','x');
hold on;
plot(t,x(:,2),'DisplayName','x''');
xlabel('t');
legend('Location','SouthEast');

[t,x] = ode23(@pendulum, [0,6*pi], [-pi, 0]);
figure;
plot(t,x(:,1),'DisplayName','x');
hold on;
plot(t,x(:,2),'DisplayName','x''');
xlabel('t');
legend('Location','SouthEast');