100% found this document useful (1 vote)
78 views

Assignment 1: Mechanical Vibrations

The document is a MATLAB code that analyzes mechanical vibrations of three cases with different initial conditions. It defines parameters like mass, spring constant, and initial displacements and velocities. It then calculates the natural frequency and period of vibration. Using the initial conditions, it computes the amplitude and phase angle for each case. Finally, it plots the displacement versus time graphs of the three cases on a single figure with three subplots, showing their oscillations and relative phase differences.
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
100% found this document useful (1 vote)
78 views

Assignment 1: Mechanical Vibrations

The document is a MATLAB code that analyzes mechanical vibrations of three cases with different initial conditions. It defines parameters like mass, spring constant, and initial displacements and velocities. It then calculates the natural frequency and period of vibration. Using the initial conditions, it computes the amplitude and phase angle for each case. Finally, it plots the displacement versus time graphs of the three cases on a single figure with three subplots, showing their oscillations and relative phase differences.
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/ 4

ASSIGNMENT 1

MECHANICAL VIBRATIONS
ME417 (A)

SUBMITTED BY

MIR MUHAMMAD UZAIR


2017204

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.

You might also like