zero函数的用法(matlab)

摘自matlab

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(..., CLASSNAME) is an array of zeros of class specified by the
string CLASSNAME.

zeros(..., 'like', Y) is an array of zeros with the same data type, sparsity,
and complexity (real or complex) as the numeric variable Y.

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是一个数组。
zeros(N):生成一个NN的零方阵。
zeros(M,N) or zeros([M,N]):生成一个M
N的零矩阵。
zeros(M,N,P,…) or zeros([M N P …]) :生成一个MNP…的零矩阵。
zeros(SIZE(A)):生成一个和A格式完全相同的零矩阵。
没有参数的0就是数值0。(confusing)
zeros(…, CLASSNAME) :指定这个零矩阵中的值为某某型(int,double,long等等)
zeros(…, ‘like’, Y):矩阵0和数学变量Y有相同的数据类型,稀疏度和复杂度(实数或者是复数)。(confusing)

注意

输入的M,N,P…都是非负整数,如果是负数一律看做0。

猜你喜欢

转载自blog.csdn.net/a137989778/article/details/83240396
今日推荐