LIBRARY
NormalNoise ​
Generates Gaussian (normal) random noise with mean mu and standard deviation sigma at each clock tick.
Uses a seeded RNG for reproducibility: the same seed and simulation time produce the same output sequence.
Usage ​
DiscreteComponents.NormalNoise(mu=0, sigma=1, seed=1)
Parameters: ​
| Name | Description | Units | Default value |
|---|---|---|---|
mu | Mean | – | 0 |
sigma | Standard deviation | – | 1 |
seed | RNG seed | – | 1 |
Connectors ​
y- This connector represents a real signal as an output from a component (RealOutput)
Variables ​
| Name | Description | Units |
|---|---|---|
td | – |
Behavior ​
Source ​
dyad
"""
Generates Gaussian (normal) random noise with mean `mu` and standard deviation `sigma` at each clock tick.
Uses a seeded RNG for reproducibility: the same `seed` and simulation time
produce the same output sequence.
"""
component NormalNoise@[input clk extends Discrete]
"Output signal"
y = RealOutput@[clk]() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0}
},
"tags": []
}
}
sampler = DiscreteComponents.Sampler() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 430, "y1": 380, "x2": 630, "y2": 580, "rot": 0}
},
"tags": []
}
}
continuousclock = BlockComponents.Sources.ContinuousClock() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 120, "y1": 380, "x2": 320, "y2": 580, "rot": 0}
},
"tags": []
}
}
"Mean"
parameter mu::Real = 0
"Standard deviation"
parameter sigma::Real = 1
"RNG seed"
parameter seed::Integer = 1
variable td::Real
relations
td@clk = sampler.y@clk
y@clk = mu + sigma * seeded_randn(seed, td)
connect(continuousclock.y, sampler.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
metadata {"Dyad": {"icons": {"default": "dyad://DiscreteComponents/NormalNoise.svg"}}}
endFlattened Source
dyad
"""
Generates Gaussian (normal) random noise with mean `mu` and standard deviation `sigma` at each clock tick.
Uses a seeded RNG for reproducibility: the same `seed` and simulation time
produce the same output sequence.
"""
component NormalNoise
"Output signal"
y = RealOutput@[clk]() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0}
},
"tags": []
}
}
sampler = DiscreteComponents.Sampler() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 430, "y1": 380, "x2": 630, "y2": 580, "rot": 0}
},
"tags": []
}
}
continuousclock = BlockComponents.Sources.ContinuousClock() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 120, "y1": 380, "x2": 320, "y2": 580, "rot": 0}
},
"tags": []
}
}
"Mean"
parameter mu::Real = 0
"Standard deviation"
parameter sigma::Real = 1
"RNG seed"
parameter seed::Integer = 1
variable td::Real
relations
td@clk = sampler.y@clk
y@clk = mu + sigma * seeded_randn(seed, td)
connect(continuousclock.y, sampler.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
metadata {"Dyad": {"icons": {"default": "dyad://DiscreteComponents/NormalNoise.svg"}}}
endTest Cases ​
No test cases defined.
Related ​
Examples
Experiments
Analyses
Tests