- 马老四
-
首先先列出matlab中help文件对zeros函数的解释:
ZEROS Zeros array.
ZEROS(N) is an N-by-N matrix of zeros.
ZEROS(M,N) or ZEROS([M,N]) is an M-by-N matrix of zeros.
ZEROS(M,N,P,...) or ZEROS([M N P ...]) is an M-by-N-by-P-by-... array of
zeros.
ZEROS(SIZE(A)) is the same size as A and all zeros.
ZEROS with no arguments is the scalar 0.
ZEROS(M,N,...,CLASSNAME) or ZEROS([M,N,...],CLASSNAME) is an
M-by-N-by-... array of zeros of class CLASSNAME.
Note: The size inputs M, N, and P... should be nonnegative integers.
Negative integers are treated as 0.
Example:
x = zeros(2,3,"int8");
然后是自己的解释:
zeros就是用来表示线性代数的0矩阵。
比如:zeros(3,3) 表示3行3列0矩阵。
- 北境漫步
-
zeros是用来生成全0矩阵的,比如,zeros(M,N) 表示的是M行*N列的0矩阵,zeros(1,10)就表示的一行全为0的矩阵(10个0);类似的还有ones(M,N)表示生成M行N列的全为1 的矩阵。
- 豆豆staR
-
zeros生成全0矩阵,比如A = zeros(4,3) 就是生产高为4 宽为3的全0矩阵
- 西柚不是西游
-
matlab中的zeros是定义一个空矩阵,是为了给以后往里存放数值预留的”磁盘空间“,告诉计算机,我要用的是这么大的矩阵,给我留好了。计算机就会空出这么大的空间,不用担心留的过多或过少而影响后期计算。你可以想象成现实生活中给饭店打电话预定多少人的餐位。以合理安排,不必造成资源的浪费。