MATLAB Functions | Help Desk |
ones
Create an array of all ones
Y=
ones(n) Y
=
ones(m,n) Y = ones([m n]) Y =
ones(d1,d2,d3...) Y = ones([d1 d2 d3...]) Y =
ones(size(A))
Y = ones(n)
returns an n
-by-n
matrix of 1
s. An error message appears if n
is not a scalar.
Y
=
ones(m,n) or Y
=
ones([m n])
returns an m
-by-n
matrix of ones.
Y = ones(d1,d2,d3...) or Y
=
ones([d1 d2 d3...])
returns an array of 1
s with dimensions d1
-by-d2
-by-d3
-by-...
.
Y = ones(size(A))
returns an array of 1
s that is the same size as A
.
eye
Identity matrix
rand
Uniformly distributed random numbers and arrays
randn
Normally distributed random numbers and arrays
zeros
Create an array of all zeros