2) MATLAB Script

w_motor = 1000; % angular velocity of fan blades (rpm)
w_worm = w_motor; % worm is connected to the motor
w_worm_gear = (w_worm)./44; % worm gear has 44 teeth
w_gear1 = w_worm_gear; % gear 1 is connected to the worm gear
N_gear1 = 12; % number of teeth on gear 1
N_gear2 = 40; % number of teeth on gear 2
TR = -(N_gear1)./(N_gear2); % gear ratio between gears 1 & 2
w_gear2_rpm = w_gear1.*TR; % angular velocity of gear 2
w_gear2 = w_gear2_rpm.*(2.*pi)./60; % convert rpm to rad/s
arm_length = 0.2; % length of oscillating arm (m)
gear_radius = 0.055; % radius of gear 2 (m)
t = (0:0.01:10); % time array

x_A = 100.*gear_radius.*cos(w_gear2.*t); % x position of point A (cm)
y_A = 100.*gear_radius.*sin(w_gear2.*t); % x position of point A (cm)
figure
plot(x_A,y_A)
grid on
title('Position of Point A With Respect to the Center of Gear 2')
xlabel('X Position (cm)')
ylabel('Y Position (cm)')

x_B = 100.*(gear_radius.*cos(w_gear2.*t)+arm_length.*sqrt(1-((gear_radius./arm_length).^2).*((sin(w_gear2.*t)).^2))); % x position of point B (cm)
y_B = zeros(1,1001); % y position of point B (cm)
figure
plot(x_B,y_B)
grid on
title('Position of Point B With Respect to the Center of Gear 2')
xlabel('X Position (cm)')
ylabel('Y Position (cm)')

vx_A = 100.*gradient(x_A); % x component of velocity at point A (cm/s)
vy_A = 100.*gradient(y_A); % y component of velocity at point A (cm/s)
v_A = sqrt(((vx_A).^2)+((vy_A).^2)); % total velocity at point A (cm/s)
figure
plot(t,v_A)
grid on
title('Velocity of Point A')
xlabel('Time (s)')
ylabel('Velocity (cm/s)')

vx_B = 100.*gradient(x_B); % x component of velocity at point B (cm/s)
vy_B = 100.*gradient(y_B); % y component of velocity at point B (cm/s)
v_B = sqrt(((vx_B).^2)+((vy_B).^2)); % total velocity at point B (cm/s)
figure
plot(t,v_B)
grid on
title('Velocity of Point B')
xlabel('Time (s)')
ylabel('Velocity (cm/s)')

theta = (180./pi).*asin((gear_radius./arm_length).*sin(w_gear2.*t)); % angle of arm with respect to toggle position (deg)
figure
plot(t,theta)
grid on
title('Angle of Fan With Respect to Center Position')
xlabel('Time (s)')
ylabel('Angle (deg)')

w_arm = (180./pi).*(gear_radius.*w_gear2.*cos(w_gear2.*t))./(arm_length.*sqrt(1-((gear_radius./arm_length).^2).*((sin(w_gear2)).^2))); % angular velocity of arm (deg/s)
figure
plot(t,w_arm)
grid on
title('Angular Velocity of Oscillation')
xlabel('Time (s)')
ylabel('Angular Velocity (deg/s)')

alpha_arm = 100.*gradient(w_arm); % angular acceleration of arm (deg/s^2)
figure
plot(t,alpha_arm)
grid on
title('Angular Acceleration of Oscillation')
xlabel('Time (s)')
ylabel('Angular Acceleration (deg/s^2)')