The displacement $x$ for a dorced damped SHO is described by:
\begin{equation} x = A e^{- \beta t} \cos\left( \omega_{d} t + \phi \right) + \left( \frac{F}{\omega Z_{m}}\right) \sin\left( \omega t - \Theta \right) \end{equation}In our model we have as initial condition:
x=0, at t=0
u=0, at t=0
Model parameters:
m = 0.5 kg
R = 5.0x103 Ns/m
K = 5.0x108 N/m
Driving force:
$F(t)=cos(2\pi f t)$
import numpy as np
import sympy as sy
from sympy import exp, sin, cos, tan, atan, atan2
sy.init_printing()
A, beta, omega_d,omega, phi, F, Z_m, theta, t, X_m, R = \
sy.symbols('A,beta,omega_d,omega,phi,F,Z_m,theta,t,X_m, R', real=True)
Use the displacement $x$ to derive an expression for $A$:
x = A *( exp(-beta * t)) * cos(omega_d*t+phi)+(F/(omega*Z_m))*sin((omega * t)-theta)
x.expand()
At t=0
:
x0t0 = x.subs(t, 0)
x0t0
which yelds to:
xsol = sy.solve(x0t0)
xsol
xsols = xsol[0][A].simplify()
xsols
Use the first derivative of the displacement $x$ to obtain an new expresion for $A$:
dx = x.diff(t)
dx.expand()
dx.simplify()
which for $u=0$ at $t=0$ is:
dx0t0 = dx.subs(t, 0)
dx0t0
dxsol = sy.solve(dx0t0)
dxsol
dxsol = dxsol[0][A].simplify()
dxsol
Use of the two expression found for A, to derive an expression for the second unknown $\phi$:
$$ A_{x} - A_{\dot{x}} = 0 $$df = dxsol - xsols
df
dfs = df.simplify()
dfs
solutions = sy.solve(dfs)
solutions
solution = solutions[1]
solution
Solve for $\phi$