You are on page 1of 28

DEPARTMENT OF MECHANICAL ENGINEERING

B.S.ABDUR RAHMAN CRESCENT


INSTITUTE OF SCIENCE & TECHNOLOGY
GST Road, Vandalur, Chennai 600 048.

LABORATORY RECORD

MEC4104 – SIMULATION LAB

NAME :_______________________________
RRN :_______________________________
SECTION:_______________________________

1
INDEX

S.No Exercise Program Simulink Viva Total Signature


(5) (3) (2) (10)
MATLAB Onramp

1 Simulation of simple
pendulum
2 Simulation of nonlinear
pendulum
3 Single degree of freedom
spring mass system with free
vibration
4 Single degree of freedom
spring mass system with
forced vibration
5 Single degree of freedom
spring-mass-damper system
with free vibration
6 Single degree of freedom
spring-mass-damper system
with forced vibration
7 Simulation of forced vibratory
system with Non-linear
damping
8 Simulation of Compound
pendulum
9 Two degree of freedom
spring-mass-damper system
with free vibration
10 Two degree of freedom free
vibratory spring-mass system
with forced vibration by
considering friction
11 Simulation of Simple
pendulum using
SimMechanics
12 Simulation of Four bar
mechanism using
SimMechanics

2
1) Write the program for the task given: The motion of the simple pendulum is modeled by the
following equation, solve the differential equation and find the displacement, velocity with
respect to time (from 0 to 120 seconds). Assume the value of ω=1 rad/sec. Analyze the
system by MATLAB Programming and validate the solution by using SIMULINK.

Equation can be written as the system of two differential equations for z=[z1,z2], with
assumptions as

Then the stage comes to reduce the second order differential equation interms of Ѳ to a first
order differential equation in terms of z which is termed as state-variable method.

MATLAB PROGRAM:-
Create the function file and save it as expone.m in the current working directory of MATLAB:

Function of the Program:-


function dzdt=expone(t,z)
w=1;
dzdt=[z(2); -w^2*sin(z(1))];

Main body of the Program:-


clc;
clear all;
w=1;
z0=[0,1];
tspan =[0,120];
[t,z] = ode45('expone',tspan,z0);
x=z(:,1);
v=z(:,2);
a=- w^2*sin(x);
plot(t,x,t,v,t,a);
xlabel(‘time in seconds’);
ylabel(‘x(t),v(t) & a(t)’);
legend ('displacement','velocity',’acceleration’);
title(‘Kinematic analysis of simple pendulum’);

3
SIMULINK DESIGN:-

Graph:

Result:

4
2) Write the program for the task given:

Initial conditions are a(0)=0.1; da(0)/dt=1


The motion of the compound pendulum is modeled by the following equation, solve the
differential equation and find the displacement, velocity and acceleration with respect to time
(from 0 to 120 seconds). Analyze the system by MATLAB Programming and validate the
solution by using SIMULINK.

MATLAB PROGRAM:-
Create the function file and save it as exptwo.m in the current working directory of MATLAB:

Function of the program:-


function dzdt=exptwo(t,z);
M=1;
R=1;
g=9.81;
b=1;
dzdt=[z(2);-(b/M*R^2)*z(2)-(g/R)*sin(z(1))];

Main body of the program:-


clc;
clear all;
M=1;
R=1;
g=9.81;
b=1;
z0=[1 0];
tspan=[0 10];
[t z]=ode45('exptwo',tspan,z0);
theta=z(:,1);
thetadot=z(:,2);
thetadott=-(b/M*R^2)*thetadot-(g/R)*sin(theta);
plot(t,theta,t,thetadot,t,thetadott);
xlabel('time in seconds');
ylabel('theta, omega and alpha');
legend('theta','thetadot','thetadott');
title(‘Kinematic analysis of system');

5
SIMULINK DESIGN:-

Graph:

Result:

6
3) Write the program for the task given: The motion of the free vibratory spring-mass system is
modeled by the following equation, solve the differential equation and find the displacement,
velocity with respect to time (from 0 to 120 seconds).Analyze the system by MATLAB
Programming and validate the solution by using SIMULINK. Assume m=1 kg, k=2 N/m.

Then the stage comes to reduce the second order differential equation in terms of x to a first
order differential equation in terms of z which is termed as state-variable method.

MATLAB PROGRAM:-
Create the function file and save it as expthree.m in the current working directory of MATLAB:

Function of the program:-

Main body of the program:-

7
SIMULINK DESIGN:

Graph:

Result:

8
4). Write the program for the task given: The motion of the forced vibratory system with spring-
mass system is modeled by the following equation, solve the differential equation and find the
displacement, velocity with respect to time (from 0 to 120 seconds).Analyze the system by
MATLAB Programming and validate the solution by using SIMULINK. Assume m=1 kg, k=2
N/m, F=120N and ω=1 rad/sec.

2 2
M*(d x/dt )+K*x(t)=F*sin(w*t)
Then the stage comes to reduce the second order differential equation in terms of x to a first
order differential equation in terms of z which is termed as state-variable method.

MATLAB PROGRAM:-
Create the function file and save it as expfour.m in the current working directory of MATLAB:
Function of the program:-

Main body of the program:-

9
5) Write the program for the task given: The motion of the free vibratory system with spring-
mass-damping system is modeled by the following equation, solve the differential equation and
find the displacement, velocity with respect to time (from 0 to 120 seconds).Analyze the system
by MATLAB Programming and validate the solution by using SIMULINK. Assume m=1 kg,
c=0.5 Ns/m, k=2 N/m.

2 2
M*(d x/dt )+C*(dx/dt)+K*x(t)=0
Then the stage comes to reduce the second order differential equation in terms of x to a first
order differential equation in terms of z which is termed as state-variable method.

MATLAB PROGRAM:-
Create the function file and save it as expfive.m in the current working directory of MATLAB:
Function of the program:-

Main body of the program:-

10
SIMULINK DESIGN:-

Graph:

Result:

11
6). Write the program for the task given: The motion of the forced vibratory system with spring-
mass-damping system is modeled by the following equation, solve the differential equation and
find the displacement, velocity with respect to time (from 0 to 120 seconds).Analyze the system
by MATLAB Programming and validate the solution by using SIMULINK. Assume m=1 kg,
c=0.5 Ns/m, k=2 N/m, ω=1 rad/sec and F=120 N.

M*(d2x/dt2)+C*(dx/dt)+K*x(t)=F*sin(ω*t)
Then the stage comes to reduce the second order differential equation in terms of x to a first
order differential equation in terms of z which is termed as state-variable method.

MATLAB PROGRAM:-
Create the function file and save it as expsix.m in the current working directory of MATLAB:
Function of the program:-

Main body of the program:-

12
SIMULINK DESIGN:-

Graph:

Result:

13
7) Write the program for the task given: The motion of the forced vibratory system with
nonlinear damping system is modeled by the following equation, solve the differential equation
and find the displacement, velocity with respect to time (from 0 to 120 seconds).Analyze the
system by MATLAB Programming and validate the solution by using SIMULINK. Assume
m=10 kg, CD=2 N/m/s, F(t)=12*sin(5*t)N.

2 2
m*(d x/dt )+CD*(dx/dt)^2=F(t)
The above equation can be rewritten as:

Then the stage comes to reduce the second order differential equation in terms of x to a first
order differential equation in terms of z which is termed as state-variable method.

MATLAB PROGRAM:-
Create the function file and save it as exptest.m in the current working directory of MATLAB:
Function of the program:-

Main body of the program:-

14
SIMULINK DESIGN:-

Graph:

Result:

15
8) Write the program for the task given: The motion of the compound pendulum is modeled by
the following equation, solve the differential equation and find the displacement, velocity
with respect to time (from 0 to 120 seconds).Assume the value of d=0.023 m, m=0.43 kg,
2
L=0.495 m, J=0.009 kg-m , c=0.00035, g=9.81. Analyze the system by MATLAB
Programming and validate the solution by using SIMULINK.

The system of above equation can be rewritten as

Equation can be written as the system of two differential equations for z=[z1,z2], with
assumptions as

Then the stage comes to reduce the second order differential equation interms of Ѳ to a
first order differential equation in terms of z which is termed as state-variable method.

MATLAB PROGRAM:-
Create the function file and save it as explearn.m in the current working directory of MATLAB:

Function of the Program:-

Main body of the Program:-

16
SIMULINK DESIGN:-

Graph:

Result:

17
9. Write the program for the task given: The motion of the Two Degree of freedom free vibratory
system with spring-mass-damping system is modeled by the following equation, solve the
differential equation and find the displacement, velocity with respect to time (from 0 to 120
seconds). Analyze the system by MATLAB Programming and validate the solution by using
SIMULINK. Assume m1=4 kg, m2=6 kg, k1=2N/m,k2=3N/m, c1=1.5Ns/m, c2=3.0 Ns/m.

MATLAB PROGRAM:-
Create the following function file and save it as twodof.m in the current working
directory of Matlab:
Function of the Program:-

18
Main Body of the Program:-

SIMULINK DESIGN:-

19
Graph 1:

Graph 2:

Result:

20
10) Write the program for the task given: The motion of the Two Degree of freedom
forced vibratory system with spring-mass system by considering friction is modeled by
the following equation, solve the differential equation and find the displacement, velocity
with respect to time (from 0 to 120 seconds). Analyze the system by MATLAB
Programming and validate the solution by using SIMULINK. Assume M1=1kg, M2=2kg,
k=1N/m, F=1; mu=0.002; g=9.81.

MATLAB PROGRAM:-
Create the following function file and save it as twodofwithfriction.m in the current
working directory of Matlab:
Function of the Program:-

21
Main Body of the Program:-

22
SIMULINK DESIGN:-

23
Graph 1:

Graph 2:

Result:

24
11) Simulation of Simple pendulum using SimMechanics.

25
26
12.) Simulation of Four bar mechanism using SimMechanics.

27
28

You might also like