pm_sampling.py
Go to the documentation of this file.
1 
2 
3 def pm(omega,omega_p):
4  '''
5  Return spectrum value as a function of freq and peak freq
6  '''
7  alpha = 0.0081
8  beta = 0.74
9  g = 9.81
10  return alpha*g**2/(omega**5)*exp(-(5.0/4.0)*(omega_p/omega)**4)
11 
12 
13 
14 
15 figure(1)
16 clf()
17 Tps = [pi]#2,4,6]
18 for Tp in Tps:
19  omega_p = 2*pi/Tp
20  omegas = linspace(omega_p*.25,omega_p*4,100)
21  s = []
22  for o in omegas:
23  s.append(pm(o,omega_p))
24  plot(omegas,s, label='$\\bar{T}=T_p$ = %.2f s, $\omega_p$=%.2f rad/s'%(Tp,omega_p))
25 
26  scale = 1.5
27  omegas = [omega_p/scale, omega_p, omega_p*scale]
28  delos = [omega_p*(1-1/scale), omega_p*(scale-1/scale)/2.0, omega_p*(scale-1)]
29  s = []
30  a = []
31  for o,d in zip(omegas,delos):
32  s.append(pm(o,omega_p))
33  a.append(sqrt(2*pm(o,omega_p)*d))
34  print 2*pi/omega_p
35  print 2*pi/array(omegas)
36  print a
37  plot(omegas,s,'o',label='Samples for s = %.2f'%scale)
38 
39 legend()
40 grid(True)
41 xlabel('$\omega \,\, [rad/s]$')
42 ylabel('$S(\omega) \,\, [m^2/(rad/s)]$')
43 title('P-M Spectrum')
44 
45 show()
def pm(omega, omega_p)
Definition: pm_sampling.py:3


vrx_gazebo
Author(s): Brian Bingham , Carlos Aguero
autogenerated on Thu May 7 2020 03:54:56