datasets
¶
Load and fetch sample data for benchmarking and testing purposes.
Functions:
Name | Description |
---|---|
gen_gbn_seq |
Generate sequence of inputs GBN. |
gen_rw_seq |
Generate a sequence of inputs as Random walk. |
make_tf |
Generate a Transfer Function object of a system. |
white_noise |
Add a white noise to a signal y. |
white_noise_var |
Generate a white noise matrix (rows with zero mean). |
gen_gbn_seq
¶
gen_gbn_seq(
n_samples: int,
p_swd: float,
n_min: int = 1,
scale: tuple[float, float] = (-1.0, 1.0),
tol: float = 0.01,
nit_max: int = 30,
seed: int | None = None,
) -> tuple[ndarray, float, int]
Generate sequence of inputs GBN.
Generate Generalized Binary Noise (GBN), apseudo-random binary sequence.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
int
|
sequence length (total number of samples) |
required |
|
float
|
desired probability of switching (no switch: 0<x<1 :always switch) |
required |
|
int
|
minimum number of samples between two switches |
1
|
|
tuple[float, float]
|
upper and lower values of the sequence |
(-1.0, 1.0)
|
|
float
|
tolerance on switching probability relative error |
0.01
|
|
int
|
maximum number of iterations to get the desired switching probability |
30
|
Return
array of given length and switching probability.
actual probability of switching (which may differ a little from p_swd
according to tol
.
number of switches in the sequence.
Examples:
Generating an array of length equal to 1000, 10% of switch probability, switching at least every 20 samples, between -10 or 5;
>>> bn_b, p_sw_b, Nswb = gen_gbn_seq(1000, 0.1, 20, (-10, 5))
References
Y. Zhu. Multivariable System Identification For Process Control. 2001.
gen_rw_seq
¶
Generate a sequence of inputs as Random walk.
Generate a random signal sequence (a random walk from a normal distribution).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
int
|
sequence length (total number of samples); |
required |
|
float
|
standard deviation (mobility) of randow walk |
1.0
|
|
float
|
initial value |
required |
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
int
|
sequence length (total number of samples) |
required |
|
float
|
initial value |
required |
|
float
|
standard deviation (mobility) of random walk |
1.0
|
|
int | None
|
seed for random number generator |
None
|
Return
array of given length and switching probability.
actual probability of switching (which may differ a little from p_swd
according to tol
.
number of switches in the sequence.
Examples:
Generating an array of length equal to 1000, 10% of switch probability, switching at least every 20 samples, between -10 or 5;
>>> bn_b, p_sw_b, Nswb = gen_gbn_seq(1000, 0.1, 20, (-10, 5))
References
Y. Zhu. Multivariable System Identification For Process Control. 2001.
make_tf
¶
make_tf(
numerator: list[float] | list[list[float]],
denominator: list[float] | list[list[float]],
ts: float = 1.0,
noise: float = 0.0,
random_state: int | None = None,
) -> TransferFunction | NestedTransferFunction
Generate a Transfer Function object of a system.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
list[float] | list[list[float]]
|
Numerator coefficients of the transfer function. |
required |
|
list[float] | list[list[float]]
|
Denominator coefficients of the transfer function. |
required |
|
float
|
Sampling time, by default 1.0. |
1.0
|
|
float
|
Standard deviation of Gaussian noise, by default 0.0. |
0.0
|
|
int | None
|
Random seed, by default None. |
None
|
Returns:
Type | Description |
---|---|
TransferFunction | NestedTransferFunction
|
TransferFunction or nested structure of TransferFunctions. |