% MITES08: Overdamped Oscillations [overdampedSHM.m]
% June 28, 08 [Sat.]
% Plots overdamped damped simple harmonic motion.

clear;

% Case 3: Overdamped SHM.

% ***** USER: Change the parameters and explore *****
% Caution: To be overdamped, need gamma > omega0 (i.e. omegaDoubleTilde < gamma !!
% See Pg. 38 of lecture notes for meaning of these two free parameters A & B:
A = 1;  
B = 5;
gamma = 8;
omegaDoubleTilde = 7;


% ***** Change the following parameter for plotting **** 
tf = 4;  % For how long would you like to observe the motion in the plot?

% After solving EOM for overdamped oscillation (Pg.38 of lecture notes)
% we obtain "underdampedSHO" being x(t) = position of particle
t = linspace(0, tf,1000); % Time: from 0s to tf in 1000 increments.
overdampedSHO = A*exp(-(gamma+omegaDoubleTilde)*t) + B*exp(-(gamma-omegaDoubleTilde)*t);


% Plot underdamped case:
plot(t, overdampedSHO, '-r');
hold on
xlabel('time');
ylabel('Position of overdamped SHO');
title('Motion of particle in overdamped simple harmonic oscillator (SHO)');
hold off

