Vibración libre sin amortiguamiento

\begin{equation} m \ddot{u} + k u = 0 \end{equation}

Suponiendo que la solución particular es la exponencial compleja

\begin{equation*} u = r \, e^{s t} \end{equation*}

Reemplazando

\begin{equation*} m \bigl( r \, s^{2} \, e^{s t} \bigr) + k \bigl( r \, e^{s t} \bigr) = 0 \end{equation*}

Simplificando

\begin{equation*} m s^{2} + k = 0 \end{equation*}

Despejando

\begin{equation*} s = \begin{cases} \phantom{+}\sqrt{-\frac{k}{m}} \\ -\sqrt{-\frac{k}{m}} \end{cases} \end{equation*}

Si llamamos frecuencia a

\begin{equation*} \omega = \sqrt{\frac{k}{m}} \end{equation*}

Reescribiendo la solución

\begin{equation*} s = \begin{cases} \phantom{+}i \, \omega \\ -i \, \omega \end{cases} \end{equation*}

Reemplazando y superponiendo las soluciones

\begin{equation*} u = r_{1} e^{i \omega t} + r_{2} e^{-i \omega t} \end{equation*}

Para que la solución sea un número real las constantes $r_{1}$ y $r_{2}$ deben ser números complejos conjugados

\begin{align*} r_{1} &= \frac{A_{2} - A_{1} i}{2} \\ r_{2} &= \frac{A_{2} + A_{1} i}{2} \end{align*}

Reemplazando

\begin{equation*} u = \biggl( \frac{A_{2} - A_{1} i}{2} \biggr) e^{i \omega t} + \biggl( \frac{A_{2} + A_{1} i}{2} \biggr) e^{-i \omega t} \end{equation*}

Factorizando

\begin{equation*} u = - A_{1} i \biggl( \frac{e^{i \omega t} - e^{-i \omega t}}{2} \biggr) + A_{2} \biggl( \frac{e^{i \omega t} + e^{-i \omega t}}{2} \biggr) \end{equation*}

Usando identidades trigonométricas

\begin{equation*} u = - A_{1} i^{2} \sin \bigl( \omega t \bigr) + A_{2} \cos \bigl( \omega t \bigr) \end{equation*}

Simplificando

\begin{equation} u = A_{1} \sin \bigl( \omega t \bigr) + A_{2} \cos \bigl( \omega t \bigr) \end{equation}

La ecuación también puede ser resuelta usando

\begin{align*} r_{1} &= \frac{a}{2} e^{i \phi} \\ r_{2} &= \frac{a}{2} e^{-i \phi} \end{align*}

Reemplazando

\begin{equation*} u = \biggl( \frac{a}{2} e^{i \phi} \biggr) e^{i \omega t} + \biggl( \frac{a}{2} e^{-i \phi} \biggr) e^{-i \omega t} \end{equation*}

Factorizando

\begin{equation*} u = a \, \frac{e^{i \bigl( \omega t + \phi \bigr)} + e^{-i \bigl( \omega t + \phi \bigr)}}{2} \end{equation*}

Usando identidades trigonométricas

\begin{equation} u = a \cos \bigl( \omega t + \phi \bigr) \end{equation}

La amplitud máxima es

\begin{equation*} a = \sqrt{A_{1}^{2} + A_{2}^{2}} \end{equation*}

El ángulo de fase es

\begin{equation*} \phi = \arctan \biggl( -\frac{A_{1}}{A_{2}} \biggr) \end{equation*}

Coeficientes

\begin{align*} A_{1} &= \frac{\dot{u}_{0}}{\omega} \\ A_{2} &= u_{0} \end{align*}

Ejemplo en clase

In [1]:
import numpy as np
import matplotlib.pyplot as plt

w = 42.0  # Tn
m = w/981 # Tn/cm/seg^2
k = 10.5  # Tn/cm
u0 = 6.2  # cm
v0 = 30.0 # cm/seg

omega = np.power(k/m,1.0/2.0)
A = v0/omega
B = u0
theta = np.arctan(-A/B)
a = np.sqrt(A**2 + B**2)

print 'omega =', omega
print 'A =', A
print 'B =', B
print 'theta =', theta
print 'a =', a
omega = 15.6604597634
A = 1.91565257044
B = 6.2
theta = -0.299671380124
a = 6.48920062647

Usando

\begin{equation*} u = A \sin \bigl( \omega t \bigr) + B \cos \bigl( \omega t \bigr) \end{equation*}

In [2]:
t = np.linspace(0,2,2000)
posicion = A*np.sin(omega*t) + B*np.cos(omega*t)

plt.figure(figsize=(19,8.5))
plt.plot(t,posicion)
plt.xlabel(r'$t$  seg.')
plt.ylabel(r'$u$  cm.')
plt.grid(True)
plt.show()

Usando

\begin{equation*} u = a \cos \bigl( \omega t + \phi \bigr) \end{equation*}

In [3]:
import numpy as np
import matplotlib.pyplot as plt

t = np.linspace(0,2,2000)
posicion = a*np.cos(omega*t + theta)

plt.figure(figsize=(19,8.5))
plt.plot(t,posicion)
plt.xlabel(r'$t$  seg.')
plt.ylabel(r'$u$  cm.')
plt.grid(True)
plt.show()

Usando odeint

\begin{align*} u^{\prime} &= z \\ m z^{\prime} + k u &= 0 \end{align*}

sujeto a $u(0) = 6.2$ y $u^{\prime}(0) = 30$

In [4]:
from scipy.integrate import odeint
import numpy as np
import matplotlib.pyplot as plt

def dU_dx(U, x):
    # Here U is a vector such that y=U[0] and z=U[1]. This function should return [z', u']
    m = 42.0/981.0
    k = 10.5
    return [U[1],-(k/m)*U[0]]
U0 = [6.2,30.0]
xs = np.linspace(0, 2, 2000)
Us = odeint(dU_dx, U0, xs)
ys = Us[:,0]

plt.figure(figsize=(19,8.5))
plt.plot(xs, ys)
plt.xlabel(r'$t$  seg.')
plt.ylabel(r'$u$  cm.')
plt.grid(True)
plt.show()

Periodo

\begin{equation*} T = \frac{2 \pi}{\omega} \end{equation*}

In [5]:
T = (2.0*np.pi)/omega
print 'T =', T
T = 0.401213336142

Tiempo hasta el ciclo 0

\begin{equation*} t_{0} = \frac{-\phi}{\omega} \end{equation*}

In [6]:
t0 = -theta/omega
print 't0 =', t0
t0 = 0.0191355416541
In [7]:
tiempo = np.zeros(14)
tiempo[0] = t0
for i in range(1,14):
    tiempo[i] = tiempo[i-1] + T
amplitud_maxima = a*np.cos(omega*tiempo + theta)
    
for i in range(14):
    print i, '\t', round(tiempo[i],3), '\t', round(amplitud_maxima[i],3)
0 	0.019 	6.489
1 	0.42 	6.489
2 	0.822 	6.489
3 	1.223 	6.489
4 	1.624 	6.489
5 	2.025 	6.489
6 	2.426 	6.489
7 	2.828 	6.489
8 	3.229 	6.489
9 	3.63 	6.489
10 	4.031 	6.489
11 	4.432 	6.489
12 	4.834 	6.489
13 	5.235 	6.489

Valor máximo aproximado

In [8]:
valor_pico = np.where(posicion >= max(posicion))[0]
print 't pico =', t[valor_pico[0]]
print 'valor pico =', posicion[valor_pico[0]]
t pico = 0.0190095047524
valor pico = 6.48918798594

Gráfico interactivo

In [9]:
import plotly.offline as offline
import plotly.graph_objs as go
import numpy as np

offline.init_notebook_mode()

t = np.linspace(0,2,2000)
posicion = a*np.cos(omega*t + theta)
trace = go.Scatter(x = t, y = posicion)
data = [trace]

offline.iplot(data)

Desplazamientos máximos

Usando la transformada de Hilbert

In [10]:
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import hilbert

t = np.linspace(0,2,2000)
posicion = a*np.cos(omega*t + theta)
analytic_signal = hilbert(posicion)
amplitude_envelope = np.abs(analytic_signal)
instantaneous_phase = np.unwrap(np.angle(analytic_signal))
instantaneous_frequency = (np.diff(instantaneous_phase)/(2.0*np.pi))
fig = plt.figure(figsize=(19,8.5))
ax0 = fig.add_subplot(211)
ax0.plot(t, posicion, label='posicion')
ax0.plot(t, amplitude_envelope, label='envolvente')
ax0.set_xlabel("tiempo en segundos")
ax0.legend()
ax1 = fig.add_subplot(212)
ax1.plot(t[1:], instantaneous_frequency)
ax1.set_xlabel("tiempo en segundos")

plt.show()

Usando argrelextrema

In [11]:
import numpy as np
from scipy.signal import argrelextrema
import matplotlib.pyplot as plt

t = np.linspace(0,2,2000)
posicion = a*np.cos(omega*t + theta)

maximo = argrelextrema(posicion, np.greater)[0] #array of indexes of the locals maxima
x = [t[maximo] for i in maximo][0]
y = [posicion[maximo] for i in maximo][0]

plt.figure(figsize=(19,8.5))
plt.plot(t,posicion)
plt.plot(x, y, 'ro')
plt.xlabel(r'$t$  seg.')
plt.ylabel(r'$u$  cm.')
plt.show() 

Desplazamiento máximo

In [12]:
for i in range(np.size(x)):
    print i, '\t', round(x[i],3), '\t', round(y[i],3)
0 	0.019 	6.489
1 	0.42 	6.489
2 	0.821 	6.489
3 	1.223 	6.489
4 	1.624 	6.489

Periodo aproximado

In [13]:
for i in range(np.size(x) - 1):
    print i+1, '\t', x[i+1]-x[i]
1 	0.4012006003
2 	0.4012006003
3 	0.4012006003
4 	0.4012006003