pyvib.forcing module

pyvib.forcing.multisine(f1=0, f2=None, N=1024, fs=None, R=1, P=1, lines='full', rms=1, ngroup=4)[source]

Random periodic excitation

Generates R realizations of a zero-mean random phase multisine with specified rms(amplitude). Random phase multisine signal is a periodic random signal with a user-controlled amplitude spectrum and a random phase spectrum drawn from a uniform distribution. If an integer number of periods is measured, the amplitude spectrum is perfectly realized, unlike classical Gaussian noise. Another advantage is that the periodic nature can help help separate signal from noise.

The amplitude spectrum is flat between f1 and f2.

Parameters:
  • f1 (float, optional) – Starting frequency in Hz. Default 0 Hz
  • f2 (float, optional) – Ending frequency in Hz. Default 0.9* nyquist frequency
  • N (int, optional) – Number of points per period. default = 1024
  • fs (float, optional) – Sample frequency. Default fs=N
  • P (int, optional) – Number of periods. default = 1
  • R (int, optional) – Number of realizations. default = 1
  • lines (array_like or str: {‘full’, ‘odd’, ‘oddrandom’}, optional) – For characterization of NLs, only selected lines are excited.
  • rms (float, optional) – rms(amplitude) of the generated signals. default = 1. Note that since the signal is zero-mean, the std and rms is equal.
  • ngroup (int, optional) – In case of ftype = oddrandom, 1 out of ngroup odd lines is discarded.
Returns:

  • u (RxNP record of the generated signals)
  • lines (excited frequency lines -> 1 = dc, 2 = fs/N)
  • freq (frequency vector)

Examples

Generate two realizations of a full multisine with 1000 samples and excitation up to one third of the Nyquist frequency. The two realizations have the same amplitude spectrum, but different phase realizations (uniformly distributed between [-π,π)) >>> N = 1000 # One thousand samples >>> kind = ‘full’ # Full multisine >>> f2 = round(N//6) # Excitation up to one sixth of the sample frequency >>> R = 2 # Two phase realizations >>> u, lines, freq = multisine(f2=f2,N=N,lines=kind,R=R)

Generate a random odd multisine where the excited odd lines are split in groups of three consecutive lines and where one line is randomly chosen in each group to be a detection line (i.e. without excitation) >>> kind = ‘oddrandom’ >>> u1,lines, freq = multisine(f2=f2,N=N,lines=kind,R=1,ngroup=3) Generate another phase realization of this multisine with the same excited lines and detection lines >>> u2,*_ = multisine(N=N,lines=lines,R=1)

Notes

J.Schoukens, M. Vaes, and R. Pintelon: Linear System Identification in a Nonlinear Setting: Nonparametric Analysis of the Nonlinear Distortions and Their Impact on the Best Linear Approximation. https://arxiv.org/pdf/1804.09587.pdf

pyvib.forcing.sineForce(A, f=None, omega=None, t=None, fs=None, ns=None, phi_f=0)[source]
Parameters:
  • A (float) – Amplitude in N
  • f (float) – Forcing frequency in (Hz/s)
  • t (ndarray) – Time array
  • n (int) – Number of DOFs
  • fdofs (int or ndarray of int) – DOF location of force(s)
  • phi_f (float) – Phase in degree
pyvib.forcing.sinesweep(amp, fs, f1, f2, vsweep, nrep=1, inctype='lin', t0=0)[source]

Do a linear or logarithmic sinus sweep excitation.

For a reverse sweep, swap f1 and f2 and set a negative sweep rate.

Parameters:
  • amp (float) – Amplitude in N
  • fs (float) – Sampling frequency
  • f1 (float) – Starting frequency in Hz
  • f2 (float) – Ending frequency in Hz
  • vsweep (float) – Sweep rate in Hz/min
  • nrep (int) – Number of times the signal is repeated
  • inctype (str (optional)) – Type of increment. Linear or logarithmic: lin/log
  • t0 (float (optional)) – Staring time, default t0=0

Notes

See scipy.signal.chirp, which does the same https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.chirp.html

pyvib.forcing.toMDOF(u, ndof, fdof)[source]