Clear Filters
Clear Filters

Creating a vector randn

2 views (last 30 days)
Desiree
Desiree on 15 Mar 2020
Edited: Sriram Tadavarty on 15 Mar 2020
Hi,
I would like to know how to create a 1x301 vector that has Gaussian distribution with 0 mean and some variance sigma. Thanks in advance!

Accepted Answer

Sriram Tadavarty
Sriram Tadavarty on 15 Mar 2020
Edited: Sriram Tadavarty on 15 Mar 2020
Hi,
This page helps you to solve this.
As stated in the page
y = sqrt(variance).*randn(1,301) + mean;
% As mean is 0, variance is sigma
sigma = 5;
mean = 0;
y = sqrt(sigma).*randn(1,301) + mean;
Hope this helps.
Regards,
Sriram

More Answers (0)

Community Treasure Hunt

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

Start Hunting!