SecondOrderElec.core

class SecondOrderElec.core.BP(Tm, m, w0)

Bases: SecondOrderElec.core.Second_Order_LTI

Band Pass filter class

Parameters:Second_Order_LTI (class) – General class for second order LTI

Band Pass filter instance constructor

Parameters:
  • Tm (float) – amplification
  • m (float) – damping coefficient
  • w0 (float) – center frequency
__init__(Tm, m, w0)

Band Pass filter instance constructor

Parameters:
  • Tm (float) – amplification
  • m (float) – damping coefficient
  • w0 (float) – center frequency
delta_w

Filter bandwidth

Returns:bandwidth of the pass band
Return type:float
den

System Denominator

Returns:system’s denominator
Return type:array_like
lti

Continuous-time linear time invariant system

Returns:lti object
Return type:scipy.signal.lti
num

System Numerator

Returns:system’s numerator
Return type:array_like
type = 'BP'
wc

Filter pass band

Returns:start and stop frequencies of the pass band
Return type:list(float, float)
class SecondOrderElec.core.General_Second_Order(m, w0)

Bases: SecondOrderElec.core.Second_Order_LTI

Class for Second order LTI systems

General Second Order filter instance constructor

Parameters:
  • m (float) – damping coefficient
  • w0 (float) – caracteristic frequency
__init__(m, w0)

General Second Order filter instance constructor

Parameters:
  • m (float) – damping coefficient
  • w0 (float) – caracteristic frequency
lti
m

Damping factor

Returns:damping factor, or damping coefficient
Return type:float
normalize()

normalize the linear system

type = 'second_order'
w0

Natural frequency

Returns:natural frequency (commonly known as w0)
Return type:float
class SecondOrderElec.core.HP(Too, m, w0)

Bases: SecondOrderElec.core.Second_Order_LTI

High Pass filter class

Parameters:Second_Order_LTI (class) – General class for second order LTI

High Pass filter instance constructor

Parameters:
  • Too (float) – amplification
  • m (float) – damping coefficient
  • w0 (float) – cut-off frequency
MdB
__init__(Too, m, w0)

High Pass filter instance constructor

Parameters:
  • Too (float) – amplification
  • m (float) – damping coefficient
  • w0 (float) – cut-off frequency
den

System Denominator

Returns:system’s denominator
Return type:array_like
lti

Continuous-time linear time invariant system

Returns:lti object
Return type:scipy.signal.lti
num

System Numerator

Returns:system’s numerator
Return type:array_like
type = 'HP'
wr
class SecondOrderElec.core.LP(T0, m, w0)

Bases: SecondOrderElec.core.Second_Order_LTI

Low Pass filter

Parameters:Second_Order_LTI (class) – General class for second order LTI

LP instance constructor

Parameters:
  • T0 (float) – amplification
  • m (float) – damping coefficient
  • w0 (float) – cut-off frequency
MdB
__init__(T0, m, w0)

LP instance constructor

Parameters:
  • T0 (float) – amplification
  • m (float) – damping coefficient
  • w0 (float) – cut-off frequency
den

System denominator

Returns:denominator
Return type:array_like
lti
num

System numerator

Returns:numerator (here T0)
Return type:float
type = 'LP'
wr
class SecondOrderElec.core.Notch(T0, m, w0)

Bases: SecondOrderElec.core.Second_Order_LTI

Notch filter class

Parameters:Second_Order_LTI (class) – General class for second order LTI

Notch filter instance constructor

Parameters:
  • T0 (float) – amplification
  • m (float) – damping coefficient
  • w0 (float) – center frequency
__init__(T0, m, w0)

Notch filter instance constructor

Parameters:
  • T0 (float) – amplification
  • m (float) – damping coefficient
  • w0 (float) – center frequency
delta_w
den
lti

Continuous-time linear time invariant system

Returns:lti object
Return type:scipy.signal.lti
num
type = 'Notch'
wc

Rejected band

Returns:start and stop frequencies of the rejected band stop
Return type:list(float, float)
class SecondOrderElec.core.Second_Order_LTI

Bases: object

General Class for Second order LTI systems

Q
R
Tp
discontinuities(var_input, var_diff_input)
freqresp(w=None, n=10000, plot=True)

return frequency response. (This method can plot it too)

Parameters:
  • w (array_like, optional) – Array of frequencies (in rad/s). Magnitude and phase data is calculated for every value in this array. If not given, a reasonable set will be calculated.. Defaults to None.
  • n (int, optional) – Number of frequency points to compute if w is not given. The n frequencies are logarithmically spaced in an interval chosen to include the influence of the poles and zeros of the system.. Defaults to 10000.
  • plot (bool, optional) – plot the frequency response. Defaults to True.
Returns:

(frequency array [rad/s], array of complex magnitude values)

Return type:

tuple(1D ndarray, 1D ndarray)

impulse(X0=None, T=None, N=None, plot=True)

return impulse response from continuous-time system. (in this case, self)

Parameters:
  • X0 (array, optional) – Initial state-vector. Defaults to None.
  • T (array, optional) – Time points. Computed if not given.. Defaults to None.
  • N (int, optional) – The number of time points to compute (if T is not given). Defaults to None.
  • plot (bool, optional) – plot the impulse response. Defaults to True.
Returns:

(array t: time (x-axis),

array s: impulse response (y-axis)

Return type:

tuple

output(U, T, X0=None, plot=True)

return output of a continuous-time linear system.

Parameters:
  • U (array_like) – An input array describing the input at each time T (interpolation is assumed between given times). If there are multiple inputs, then each column of the rank-2 array represents an input. If U = 0 or None, a zero input is used.
  • T (array_like) – The time steps at which the input is defined and at which the output is desired. Must be nonnegative, increasing, and equally spaced.
  • X0 (array_like, optional) – The initial conditions on the state vector (zero by default). Defaults to None.
  • plot (bool, optional) – plot output. Defaults to True.
Returns:

Time values for the output, system output, time evolution of the state vector

Return type:

tuple(1D ndarray, 1D ndarray, ndarray)

pzmap(plot=True)

return poles and zeros.

Parameters:plot (bool, optional) – plot poles and zeros. Defaults to True.
Returns:(poles,zeros)
Return type:tuple
step(X0=None, T=None, N=None, plot=True)

return step response

Parameters:
  • X0 (array_like, optional) – Initial state-vector. Defaults to None.
  • T (array_like, optional) – Time points. Defaults to None.
  • N (int, optional) – Number of time points to compute if T is not given. Defaults to None.
  • plot (bool, optional) – plot the step reponse. Defaults to True.
Returns:

Time values for step response, step response

Return type:

tuple(ndarray, ndarray)

wp