Creating a vector randn

1 回表示 (過去 30 日間)
Desiree
Desiree 2020 年 3 月 15 日
編集済み: Sriram Tadavarty 2020 年 3 月 15 日
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!

採用された回答

Sriram Tadavarty
Sriram Tadavarty 2020 年 3 月 15 日
編集済み: Sriram Tadavarty 2020 年 3 月 15 日
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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by