% Frank Fisher
% ME 345 - Mod/Sim
% governor problem - simplified
% analytical expression to understand behavior
clc; clear; close all
L = .784; % length of the cord; chosen so that at 60 deg at equilibrium
g=9.8; % gravitational constant
w=5; % constant rotational frequency
t=0:.05:2; % time
% note: damping is not included here
% First solution - particular solution with y(t=0)=0
y= (-g/w^2).*cos(w.*t) + (g/w^2);
plot_first_solution=0; %only plots first solution when I want
if plot_first_solution==1
plot(t,y)
xlabel('time');
ylabel('position of the `weight`');
end
% Second solution - can show analytically that can set the right initial condition so that
% the y(t) = constant (no oscillation) such that y = (g/w^2)
%Third solution - write solution in more general form as a function of
%initial y-displacement (y(t=0)=0)
%will loop over values of theta
counter=0;
for theta = 0:15:75
counter=counter+1;
angle_track(counter)=theta; % store angles - not used as of now
y0=L*cos(theta*pi/180)
y_general(counter,:) = (y0 - g./w.^2).*cos(w.*t) + g./w.^2;
end
plot_2_solution=1; %only plots first solution when I want
if plot_2_solution==1
plot(t,y_general)
xlabel('time');
ylabel('position of the `weight`');
legend('0','15','30','45','60','75') %note - assume know how many angles
end