Week_8 Assignment(Sub)
Week_8 Assignment(Sub)
% Extract variables
theta1 = X(:, 1);
d2 = X(:, 2);
theta1_dot = X(:, 3);
d2_dot = X(:, 4);
% Plot results
figure;
subplot(4, 1, 1);
plot(t, theta1);
xlabel('Time (s)');
ylabel('\theta_1 (rad)');
title('\theta_1 vs. Time');
subplot(4, 1, 2);
plot(t, d2);
xlabel('Time (s)');
ylabel('d2 (m)');
title('d2 vs. Time');
subplot(4, 1, 3);
plot(t, theta1_dot);
xlabel('Time (s)');
ylabel('\theta_1_dot (rad/s)');
title('\theta_1_dot vs. Time');
subplot(4, 1, 4);
plot(t, d2_dot);
xlabel('Time (s)');
ylabel('d2_dot (m/s)');
title('d2_dot vs. Time');