Untitled Document
Untitled Document
AIM:
To write a program to simulate and visualize the motion of a simple pendulum.
SOFTWARE REQUIRED:
PC loaded with SCILAB software.
THEORY:
A simple pendulum consists of a mass (bob) attached to a string of fixed length that swings
back and forth under the influence of gravity. The motion of a pendulum can be described
using the principles of classical mechanics. The key equations governing the motion of a
simple pendulum are derived from Newton's laws and can be summarized as follows:
1. **Angular Displacement:**
The angle θ of the pendulum from the vertical position can be described as a function of
time.
2. **Angular Acceleration:**
The angular acceleration α of the pendulum is given by:
α = - (g / L) * sin(θ)
where:
- g is the acceleration due to gravity (approximately 9.81 m/s²),
- L is the length of the pendulum.
3. **Equations of Motion:**
The angular velocity ω and angle θ can be updated using numerical methods (e.g., Euler's
method):
ω(t + dt) = ω(t) + α * dt
θ(t + dt) = θ(t) + ω(t) * dt
4. **Energy Considerations:**
The pendulum's motion is periodic, and its energy is conserved in the absence of air
resistance and friction.
5. **Damping Effects:**
In a real-world scenario, damping forces (like air resistance) can affect the motion of the
pendulum, causing it to lose energy over time. This simulation assumes an ideal pendulum
without damping.
PROGRAM CODE:
```scilab
// Pendulum Simulation
// Constants
g = 9.81; // Acceleration due to gravity (m/s^2)
L = 1; // Length of the pendulum (m)
theta0 = 30 * %pi / 180; // Initial angle (degrees to radians)
omega0 = 0; // Initial angular velocity (rad/s)
// Time parameters
t_max = 10; // Total time of simulation (s)
dt = 0.01; // Time step (s)
t = 0:dt:t_max; // Time vector
subplot(2, 1, 2);
plot(t, omega, 'r-');
xlabel('Time (s)');
ylabel('Angular Velocity (rad/s)');
title('Angular Velocity of Pendulum');
grid on;
RESULT:
The program successfully simulates and visualizes the motion of a simple pendulum.
The angle and angular velocity of the pendulum are plotted over time, and the final
angle and angular velocity are displayed in the console.
DISCUSSION:
CONCLUSION:
The pendulum simulator provides a clear visualization of the dynamics of a simple
pendulum. It can be further extended to include damping effects or to simulate
multiple pendulums interacting with each other.