lmlib.utils.generator.gen_rect#

lmlib.utils.generator.gen_rect(K, k_period, k_on=None, duty_cycle=None, k0=0)#

Rectangular (pulse wave) signal generator

Parameters
  • K (int) – Signal length

  • k_period (int) – periodicity, number of samples per period

  • k_on (int, optional) – Number of samples of value 1, followed by k_period-k_on samples of value 0. Default is k_period//2 (only k_on or duty_cycle can be used)

  • duty_cycle (float, optional) – Duty Cycle of a period (starts with 1). Default is k_period//2 (only k_on or duty_cycle can be used)

  • k0 (int, optional) – Start shift of a period, default k0=0

Returns

out – Returns a rectangular wave signal of length K.

Return type

ndarray, shape=(K,)