- Random Number Block: https://www.mathworks.com/help/simulink/slref/randomnumber.html
- To Workspace Block: https://www.mathworks.com/help/simulink/slref/toworkspace.html
- sim: https://www.mathworks.com/help/simulink/slref/sim.html
How to Generate White Gaussian Noise using Random Number Generator Block in Simulink?
9 views (last 30 days)
Show older comments
I have to generate White Gaussian Noise with "Zero Mean" using Random Number Block in Simulink. The Random Number Block requires 4 inputs which are "Mean","Variance","Initial SEED" and "Sample Time".
Now for Mean the value will be "0", what about variance? will I have to put "Standard Deviation" or "Square of Standard Deviation" as "variance" input?
0 Comments
Answers (1)
Aastha
on 18 Jun 2025
According to MathWorks documentation of the Random Number block, "variance" input is the variance of the normally distributed random numbers.
Thus, you can provide the square of the standard deviation as input.
To verify this, you can connect the Random Number Block configured with the appropriate mean and variance values to a To Workspace Simulink block. This block logs the Simulink block output to the MATLAB workspace.
Next you can use the "sim" function in MATLAB which is used to run the Simulink model programmatically in a MATLAB script. You may then use the "var" function in MATLAB to compute the variance of the generated data. Kindly refer to the MATLAB code snippet below to do so:
out = sim("randomNumberBlock.slx");
variance = var(out.simout.Data);
For more information on the Simulink blocks and MATLAB functions, please refer to the MathWorks documentation linked below:
I hope this is helpful!
0 Comments
See Also
Categories
Find more on Random Number Generation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!