0% found this document useful (0 votes)
30 views5 pages

Assignment 5 Phase Angle

This document contains a MATLAB code submission for an assignment on mechanical vibrations. The code calculates and plots the displacement transmissibility for different damping ratios over a range of frequency ratios. It also contains a second MATLAB code that calculates and plots the phase angle as a function of frequency ratio for different damping coefficients.

Uploaded by

Muhammad Tayyab
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)
30 views5 pages

Assignment 5 Phase Angle

This document contains a MATLAB code submission for an assignment on mechanical vibrations. The code calculates and plots the displacement transmissibility for different damping ratios over a range of frequency ratios. It also contains a second MATLAB code that calculates and plots the phase angle as a function of frequency ratio for different damping coefficients.

Uploaded by

Muhammad Tayyab
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/ 5

Mechanical Vibrations

Assignment # 5

Phase Angle vs Frequency Ratio

Submission Date: 27-11-2023

Name: Muhammad Tayyab

Roll No 035

Batch: BSME 2020-24

Submitted To Dr. Zahid Iqbal


MATLAB Code for Displacement Transmissibility
% System parameters
m = 1; % mass
%c = 0.1; % damping coefficient
k = 1; % stiffness
F0 = 1; % amplitude of the force
Y=5;
% Frequency range
omega_range = 0: 0.1: 10; % adjust the range as needed
Cc=2*sqrt(k*m)
% Damping ratios to be considered
zeta_values = [0.1, 0.2, 0.3, 0.4, 0.5,1, 1.2, 1.5];

% Initialize arrays to store results


max_amplitudes = zeros(length(zeta_values), length(omega_range));

% Loop over each damping ratio


for i = 1:length(zeta_values)
zeta = zeta_values(i);
c=zeta*Cc
% Loop over each forcing frequency
for j = 1:length(omega_range)
omega = omega_range(j);

% Solve the differential equation


tspan = [0, 20];
initial_conditions = [0; 0]; % initial position and velocity
[t, x] = ode45(@(t, x) [x(2); -(c/m)*(x(2) - Y*omega*cos(omega*t)) -
(k/m)*(x(1) - Y*sin(omega*t))], tspan, initial_conditions);

% Find maximum amplitude


max_amplitudes(i, j) = max(x(:, 1));
end
end

% Plot results
figure;
plot(omega_range, max_amplitudes/Y);
xlabel('Frequency Ratio (\omega/\omega_n)');
ylabel('Maximum Amplitude');
title('Force Vibration with Viscous Damping');
legend(strcat('\zeta = ', cellstr(num2str(zeta_values'))));
grid on;
Results

Phase Angle Matlab Code


% Define the range of r values
r = linspace(0, 10, 100);

% Define different values for zeta


zeta_values = [0.1,0.2,0.3,0.4 0.5, 1, 2];

% Plot phi vs r for each zeta value


figure;
hold on;

for i = 1:length(zeta_values)
zeta = zeta_values(i);
phi_rad = atan((2*zeta*r.^3)./(1+(4*zeta^2-1)*r.^2));
% Convert phi from radians to degrees
phi_deg = rad2deg(phi_rad);

% Ensure phi is in the range [0, 180]


phi_deg(phi_deg < 0) = phi_deg(phi_deg < 0) + 180;

plot(r, phi_deg, 'DisplayName', ['\zeta = ' num2str(zeta)]);


end

hold off;

% Add labels and legend


xlabel('r');
ylabel('\phi (degrees)');
title('Plot of \phi vs r for different \zeta values');
legend('show');

Result

You might also like