Assignment 1: Mechanical Vibrations
Assignment 1: Mechanical Vibrations
MECHANICAL VIBRATIONS
ME417 (A)
SUBMITTED BY
SUBMITTED TO
MS SADIA BAKHTIAR
MATLAB code
Example 1.14
clc
clear screen
m=2;
k=200;
x01=2;
v01=1;
x02=-2;
v02=1;
x03=2;
v03=-1;
%first we will calculate the natural frequency through eguation w^2=k/m
w=sqrt(k/m)
T=(2*pi)/w
t=0:T/49:5*T; %time period
%now putting the initial conditions we will find the two constant i.e. A
%and phi, as for A the initial conditions will give the same answer for all
%three cases then we will compute it only once
A=(sqrt((w^2*x01^2)+v01^2))/w
%now to find the phi angle for all three cases:
phi1=atan2((w*x01),v01)
phi2=atan2((w*x02),v02)
phi3=atan2((w*x03),v03)
%phi3=phi3+pi %180 degree phase shift if we use the other method
%wt=w*t;
x1=A*sin((w*t+phi1));
x2=A*sin((w*t+phi2));
x3=A*sin((w*t+phi3));
subplot(3,1,1)
plot(t,x1,'red')
xlabel('time')
ylabel('displacement')
subplot(3,1,2)
plot(t,x2,'blue')
xlabel('time')
ylabel('displacement')
subplot(3,1,3)
plot(t,x3,'green')
xlabel('time')
ylabel('displacement')
MATLAB Solution:
Graph
As its evident from the graph that there is certain phase change in all the three curves. In the first graph
the phase angle is 1.5208 and the second graph is it is -1.5208 and the phase shift is approx. 174.28 degree.
For the graph 2 and 3 the phase shift is 5.703 degree and graph 3 is leading graph 2 by 5.703 degree.