MATLAB rand function details

Source: Internet
Author: User

Random Number or matrix with uniform distribution
Syntax
Y = rand (N)
Y = rand (m, n)
Y = rand ([m n])
Y = rand (M, N, P ,...)
Y = rand ([m n p...])
Y = rand (SIZE ())
Rand
S = rand ('state ')
Description
The rand function generates an array composed of random numbers evenly distributed between (0, 1.
Y = rand (n) returns a random matrix of N x n. If n is not a quantity, an error is returned.
Y = rand (m, n) or Y = rand ([m n]) returns a random matrix of m x n.
Y = rand (M, N, P,...) or Y = rand ([m n p...]) to generate a random array.
Y = rand (SIZE (A) returns a random matrix of the same size as.

1, Rand (3) *-2 Rand (3) is a 3*3 random matrix (the value range is 0 ~ Between 1)
Then, each number is multiplied by 2.

2. Use MATLAB to randomly generate 60 positive numbers 1 + fix (365 * rand (365) between 1 and ));

3. Use the rand function to randomly retrieve 100 numbers from-1 to 1 x1, x2,..., x = rand (1,100) * 2-1

MATLAB rand function details

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.