Forced Vibration Experiment Matlab Program

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

% Script Name : Forced_Vibration_Experiment.

m
clear ;
close all ;
clc ;
tic ;
fprintf('The Course Name : \nME 492 : Applied Mechanics Lab\n\n') ;
fprintf('The Semester : \nFall - 2023\n\n') ;
fprintf('The Experiment Name : \nThe Forced Vibration Experiment\n\n') ;
fprintf('The Technical Data for the Experiment Including the following Parameters : \n\
n') ;
E = 200e9 ;
fprintf('(1) The beam modulus of elasticity is : \nE = 200 GPa = %0.2e Pa (Not Used in
Calculations) ==> (Steel Alloy) \n\n' , E) ;
L = 700e-3 ;
fprintf('(2) The Beam length is : \nL = 700 mm = %0.3f m\n\n' , L) ;
w = 25e-3 ;
fprintf('(3) The beam width is : \nw = 25 mm = %0.3f m\n\n' , w) ;
h = 12e-3 ;
fprintf('(4) The beam height is : \nh = 12 mm = %0.3f m\n\n' , h) ;
I = (w*h^3)/12 ;
fprintf('The Beam Area Moment of Inertia (Second Moment of Area) is : \nI = %0.5e m ⁴\n\
n' , I) ;
m = 1.68 ;
fprintf('(5) Mass of the beam is : \nm = %0.3f kg\n\n' , m) ;
k = 3000 ;
fprintf('(6) The Spring constant is : \nk = %0.0f (N/m)\n\n' , k) ;
C = 10 ;
fprintf('(7) The Damping constant is : \nC = %0.0f (N.sec/m)\n\n' , C) ;
me = 0.10 ;
fprintf('(8) The Unbalancing mass is : \nme = %0.3f kg\n\n' , me) ;
e = 10e-3 ;
fprintf('(9) The Unbalancing mass Eccentricity is : \ne = 10 mm = %0.3f m\n\n' , e) ;
% Damping Ratio ζ
zeta = [0 ; 0.100] ;
fprintf('The Damping Ratio Values are : \nζ_1 = %0.0f and ζ_2 = %0.2f\n\n' , zeta(1) ,
zeta(2)) ;
% The Natural Angular Frequency Value, omege_n = sqrt((3*k) / m) in [rad/sec]
omega_n = sqrt((3 * k) / m) ; % (rad/sec)
fprintf('The Natural Angular Frequency Value is : \nω_n = %0.6f (rad/sec)\n\n' ,
omega_n) ;
% The Natural Frequency Value, f_n = (ω_n)/(2π) in [Hz]
f_n = omega_n / (2*pi) ; % Hz or (cycle/sec)
fprintf('The Natural Frequency Value is : \nf_n = %0.6f Hz\n\n' , f_n) ;
% The Frequency Vector, f = [6 : 1 : 16] Hz or (cycle/sec)
f = linspace(6 , 16 , 11)' ;
% The Exciting Angular Frequency Vector, omege = (2 × π × f) [rad/sec]
omega = 2*pi.*f ;
% The Angular Frequency Ratio Vector, r = omega./omega_n
r = omega./omega_n ;
% The Exciting Force Amplitude Vector, F0 = me × e × Ω² [N]
F0 = me*e.*omega.^2 ;
% No Damping (ζ = 0)
Magnification_Factor_Th_No_Damping = 1./(sqrt(((1 - r.^2).^2) + ((2*zeta(1).*r).^2))) ;
Magnification_Factor_Exp_No_Damping = [1.5721 , 1.7443 , 2.2321 , 2.8588 , 4.3869 ,
10.2320 , 19.6110 , 5.1146 , 2.5871 , 1.9213 , 1.4125]' ;
Xs_No_Damping = F0./k ;
Xd_No_Damping = (F0.*Magnification_Factor_Exp_No_Damping)./k ;
% Damping (ζ = 10 % = 0.1)
Magnification_Factor_Th_Damping = 1./(sqrt(((1 - r.^2).^2) + ((2*zeta(2).*r).^2))) ;
Magnification_Factor_Exp_Damping = [1.57901 , 1.7368 , 2.1431 , 2.6531 , 3.5832 , 4.9493 ,
5.3652 , 3.6514 , 2.4913 , 1.7827 , 1.3271]' ;
Xs_Damping = F0./k ;
Xd_Damping = (F0.*Magnification_Factor_Exp_Damping)./k ;
Final_Results_1 = table(f , omega , r , F0 , ...
'VariableNames' , {'Frequency_(Hz)' , 'Exciting_Angular_Freq_(rad/sec)' ,
'Angular_Freq_Ratio' , 'Exciting_Force_Amplitude_(N)'}) ;
disp('The Final Results # 1 :')
disp (' ') ;
disp(Final_Results_1) ;
Final_Results_2 = table(Xs_No_Damping , Xd_No_Damping , Xs_Damping ,
Xd_Damping , ...
'VariableNames' , {'Static_Response_No_Damping_(m)' ,
'Dynamic_Response_No_Damping_(m)' , 'Static_Response_Damping_(m)' ,
'Dynamic_Response_Damping_(m)'}) ;
disp('The Final Results # 2 :')
disp (' ') ;
disp(Final_Results_2) ;
Final_Results_3 = table(Magnification_Factor_Th_No_Damping ,
Magnification_Factor_Exp_No_Damping , Magnification_Factor_Th_Damping ,
Magnification_Factor_Exp_Damping , ...
'VariableNames' , {'Theor_Mf_No_Damping' , 'Exp_Mf_No_Damping' ,
'Theor_Mf_Damping' , 'Exp_Mf_Damping'}) ;
disp('The Final Results # 3 :')
disp (' ') ;
disp(Final_Results_3) ;
% Ploting the Magnification Factor versus the Angular Frequency Ratio
figure(1) ; % No Damping (ζ = 0)
plot(r , Magnification_Factor_Th_No_Damping , 'lineWidth' , 3) ;
set(gca , 'lineWidth' , 3 , 'fontWeight' , 'bold' , 'fontSize' , 15) ;
hold on ;
plot(r , Magnification_Factor_Exp_No_Damping , 'lineWidth' , 3) ;
xlabel('Angular Frequency Ratio, r = (\omega / \omega_{n})' , 'fontSize' , 17) ;
ylabel('Magnification Factor, M_{f} = (X_{D} / X_{Static}) ' , 'fontSize' , 17) ;
title(' Magnification Factor vs Angular Frequency Ratio (No Damping Case)' , 'FontSize' ,
18) ;
legend(' Theoretical Magnification Factor, (M_{f})_{Th} for \zeta = 0' , ' Experimental
Magnification Factor, (M_{f})_{Exp} for \zeta = 0' , 'FontSize' , 16 , 'location' ,
'northoutside') ;
xlim([r(1) (r(end)*1.02)]) ;
grid ('minor') ; grid on ;
axis xy ; box on ; hold off ;
hold off ;
figure(2) ; % Damping (ζ = 10 % = 0.1)
plot(r , Magnification_Factor_Th_Damping , 'lineWidth' , 3) ;
set(gca , 'lineWidth' , 3 , 'fontWeight' , 'bold' , 'fontSize' , 15) ;
hold on ;
plot(r , Magnification_Factor_Exp_Damping , 'lineWidth' , 3) ;
xlabel('Angular Frequency Ratio, r = (\omega / \omega_{n})' , 'fontSize' , 17) ;
ylabel('Magnification Factor, M_{f} = (X_{D} / X_{Static}) ' , 'fontSize' , 17) ;
title(' Magnification Factor vs Angular Frequency Ratio (Damping Case) ' , 'FontSize' ,
18) ;
legend(' Theoretical Magnification Factor, (M_{f})_{Th} for \zeta = 10 % = 0.10' , '
Experimental Magnification Factor, (M_{f})_{Exp} for \zeta = 10 % = 0.10' , 'FontSize' , 16
, 'location' , 'northoutside') ;
xlim([r(1) (r(end)*1.02)]) ;
grid ('minor') ; grid on ;
axis xy ; box on ; hold off ;
hold off ;
toc ; % calculation and display the time required for the program running in seconds.

You might also like