How to Generate White Gaussian Noise using Random Number Generator Block in Simulink?

11 次查看(过去 30 天)
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?

回答(1 个)

Aastha
Aastha 2025-6-18
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!

类别

Help CenterFile Exchange 中查找有关 Random Number Generation 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by