最近在写matlab 程序,一些常用的函数及表示方法经常查找,为以后方便,特记录一下
1-nnz查找矩阵中非零元素的个数:
n = nnz(X)
returns the number of nonzero elements in matrix X
.
2-prod 计算元素的乘积
returns the product of the array elements of B
= prod(A
)A
.
3-fftshift/ifftshift,将零频率移至频谱中心
Y = fftshift(X)
rearranges the outputs of fft
, fft2
, and fftn
by moving the zero-frequency component to the center of the array.
ifftshift(X,dim)
applies the ifftshift
operation along the dimension dim
.
The difference between fftshift
and ifftshift
is important for input sequences of odd-length.
N = 5;