Randomly generated Gaussian distribution sequence data randn

Source: Internet
Author: User

I personally think that randn is approximate when the data is very long. The details are as follows:
Assume that you want to generate a random sequence with the mean of B and the variance of A, inMATLABThe following table is provided in help.
X = B + SQRT (a) * randn (1,000000 );
(You can use mean (X) and VAR (X) to check the mean value and variance. We will find that the mean value is approximately equal to B and ).
The mean and variance of data generated in a short period of time are generally not met. I usually do this (that is, I also produce the data when the data is long) for reference only:
According to your requirements, assume that the mean value of the 200 column in a row is B, and the variance is:
X = randn (1,200 );
X = x-mean (X );
X = B + SQRT (a) * x/SQRT (VAR (x ));

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.