Physics 238
Damped Oscillations

Clear["Global`*"]

x[t_, γ_] := B Exp[p[γ] t]

p[γ_] := (-γ/2) + I Sqrt[((ω0)^2) - (γ^2)/4 ]

ω0 =1.0; (* For convenience in plotting *)

Initial Conditions -- set B = 10.0 (not exactly releasing from rest)

B = 10.0 ;

smartlabel[γ_] := StringForm["γ = `` ω0   Q = ``", NumberForm[γ, {3, 2}], NumberForm[ω0/γ, {4, 3}]] // Quiet

Manipulate[Plot[Re[x[t, γ]], {t, 0, 40}, PlotRange->{{0, 40},{-10, 10}},LabelStyle->Larger, Frame->True,PlotLabel ->smartlabel[γ],  FrameLabel -> {"t", "x"}, ImageSize->Scaled[0.9], AspectRatio->1/2],
{γ, 0, 4, 0.02, Appearance -> "Open"}]

Plot[{Re[x[t, 0.5]], Re[x[t, 2.0]], Re[x[t, 8.0]]}, {t, 0, 40}, PlotRange->{{0, 20}, {-10, 10}}, ImageSize->Scaled[0.7], AspectRatio->1/2, PlotStyle->{Red, Green, Blue}, PlotLegends -> {"γ = 0.5 ω0", "γ = 2.0 ω0","γ = 8.0 ω0"}, LabelStyle->Larger ]