0% found this document useful (0 votes)
11 views3 pages

Untitled Document

The document outlines a program to simulate the motion of a simple pendulum using SCILAB software, detailing the necessary theory, equations of motion, and program code. It successfully visualizes the pendulum's angle and angular velocity over time, demonstrating its periodic nature and energy loss. The conclusion suggests potential extensions to the simulation, such as incorporating damping effects or multiple interacting pendulums.

Uploaded by

Amit Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views3 pages

Untitled Document

The document outlines a program to simulate the motion of a simple pendulum using SCILAB software, detailing the necessary theory, equations of motion, and program code. It successfully visualizes the pendulum's angle and angular velocity over time, demonstrating its periodic nature and energy loss. The conclusion suggests potential extensions to the simulation, such as incorporating damping effects or multiple interacting pendulums.

Uploaded by

Amit Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

EXPERIMENT-11

PENDULUM SIMULATOR USING SCILAB

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

// Clear previous variables and figures


clear;
clc;
clf;

// 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

// Initialize arrays for angle and angular velocity


theta = zeros(1, length(t));
omega = zeros(1, length(t));

// Set initial conditions


theta(1) = theta0;
omega(1) = omega0;

// Simulation loop using the Euler method


for i = 1:length(t)-1
// Calculate angular acceleration
alpha = - (g / L) * sin(theta(i));

// Update angular velocity and angle


omega(i+1) = omega(i) + alpha * dt;
theta(i+1) = theta(i) + omega(i) * dt;
end

// Convert angles from radians to degrees for plotting


theta_deg = theta * (180 / %pi);

// Plotting the results


clf;
subplot(2, 1, 1);
plot(t, theta_deg, 'b-');
xlabel('Time (s)');
ylabel('Angle (degrees)');
title('Pendulum Motion');
grid on;

subplot(2, 1, 2);
plot(t, omega, 'r-');
xlabel('Time (s)');
ylabel('Angular Velocity (rad/s)');
title('Angular Velocity of Pendulum');
grid on;​

// Display final angle and angular velocity


disp("Final Angle: " + string(theta_deg($)) + " degrees");
disp("Final Angular Velocity: " + string(omega($)) + " rad/s");

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:

●​ The simulation demonstrates the periodic nature of pendulum motion.


●​ The angle of the pendulum decreases over time, indicating that the pendulum
is losing energy (in a real-world scenario, this would be due to damping).
●​ The results can be analyzed to understand the effects of varying the length of
the pendulum or the initial angle on the motion.

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.

You might also like