全0矩阵是指元素都为0的矩阵,全1矩阵是指元素都为1的矩阵,分别通过zeros( )函数和ones( )函数创建。
在命令窗口输入以下程序:
Matlab
A1=zeros(2,2)
A2=ones(2,2)
输出结果为
A1=
0 0
0 0
A2=
1 1
1 1