To create a normally distributed data in MATLAB, you can use the normrnd()
function provided by the Statistics and Machine Learning Toolbox.
The normrnd()
function generates random numbers from the normal (Gaussian) distribution with mean mu and standard deviation sigma. Here's an example code snippet to create a normally distributed data:
main.m198 chars5 lines
In the above code, we first set the mean value mu
and standard deviation sigma
. Next, we use normrnd() function to generate 100 random numbers using these parameters.
You can change the mean value and standard deviation as per your requirement.
gistlibby LogSnag