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