You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note how the default mid-rise quantizer mode has a rise at the middle of the interval, while the mid-tread mode has a flat region (a tread) centered around the middle of the interval.
148
149
149
150
The default option `midrise = true` includes both end points as possible output values, while `midrise = false` does not include the upper limit.
151
+
152
+
153
+
## Sampling with AD effects
154
+
The block [`SampleWithADEffects`](@ref) combines an ideal [`Sampler`](@ref), a [`NormalNoise](@ref) and a [`Quantization`](@ref) block to simulate the undesirable but practically occurring effects of sampling, noise and quantization in an AD converter. The block has the connectors `input` and `output`, where the input is the continuous-time signal to be sampled, and the output is the quantized, noisy signal. Example:
Both quantization and noise addition are optional and turned off by default. In the example above, we turn them on with keywords `noisy = true` and `quantized = true`. The noise is Gaussian white noise with standard deviation `sigma`, and the quantization is a 3-bit midrise quantizer (8 output levels) with limits `y_min` and `y_max`. Limits have to be provided when quantization is used. The `dt` parameter is the sampling time, if left unspecified, it will be inferred from context.
180
+
181
+
Things to notice in the plot:
182
+
- The sampled signal is saturated at the quantization limits ±1.
183
+
- The noise is added to the signal before quantization, which means that the sampled signal has ``2^\text{bits}`` distinct output levels only.
184
+
- 0 is not a possible output value. In situations where 0 is an important value (such as in the presence of integration of a quantized value that is expected to be close to 0), the mid-tread quantizer should be used instead by passing `midrise = false`.
A sampler with additional effects that appear in practical systems, such as measurement noise and quantization.
1087
+
1088
+
The operations occur in the order
1089
+
1. Sampling
1090
+
2. Noise addition
1091
+
3. Quantization
1092
+
1093
+
# Structural parameters:
1094
+
- `quantized`: If true, the output is quantized. When this option is used, the output is quantized to the number of bits specified by the `bits` parameter. The quantization is midrise if `midrise = true`, otherwise it is midtread. The output is also limited to the range `[y_min, y_max]`.
1095
+
- `noisy`: If true, the output is corrupted by additive white Gaussian noise with standard deviation `sigma` (defaults to 0.1). If `noisy = false`, the noise block is a unit gain.
1096
+
- `dt`: Sample interval of the sampler. If not specified, the sample interval is inferred from the clock of the system.
1097
+
- `clock`: Clock signal of the system. If not specified, the sample interval is inferred from the clock of the system. If `clock` is specified, the parameter `dt` has no effect.
1098
+
1099
+
# Parameters:
1100
+
- `y_min`: Lower limit of output, defaults to -1. Only used if `quantized = true`.
1101
+
- `y_max`: Upper limit of output, defaults to 1. Only used if `quantized = true`.
1102
+
- `bits`: Number of bits of quantization, defaults to 8 (256 output levels between `y_min` and `y_max`). Only used if `quantized = true`.
1103
+
- `sigma`: Standard deviation of the additive Gaussian noise, defaults to 0.1. Only used if `noisy = true`.
0 commit comments