1. 程式人生 > >zero函式的用法(matlab)

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。