zeros()

Description:

Create a multidimensional matrix where all the elements are zero.

Syntax:

zeros(n1,n2,…)

Note:

An external library function where ni defines sizes of dimensions in order. The function creates a new n*n square matrix when there is only one parameter n.

Parameters:

ni

A positive integer

Return value:

A sequence

Example:

 

A

 

1

=zeros(4,3)

 

 

 

Generate a 4*3 matrix whose elements are all zero

2

=zeros(3)

 

 

 

Generate a matrix of size 3 whose elements are all zero

3

=zeros(4,3,5)

Generate a multidimensional matrix whose elements are all zero