matlab 一些最近使用的操作

这篇博客记录了MATLAB编程中的一些常用操作,包括nnz函数用于查找矩阵中非零元素的数量,prod函数计算元素的乘积,以及fftshift和ifftshift函数如何将零频率移至频谱中心,便于理解和应用。
摘要由CSDN通过智能技术生成

最近在写matlab 程序,一些常用的函数及表示方法经常查找,为以后方便,特记录一下


1-nnz查找矩阵中非零元素的个数:

n = nnz(X) returns the number of nonzero elements in matrix X.


2-prod 计算元素的乘积

B = prod(A) returns the product of the array elements of A.


3-fftshift/ifftshift,将零频率移至频谱中心

Y = fftshift(X) rearranges the outputs of fftfft2, 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;

X = 0:N-1;
Y = fftshift(fftshift(X));
Z = ifftshift(fftshift(X));
Notice that Z is a correct replica of X, but Y is not.
isequal(X,Y),isequal(X,Z)
在处理频率信号的时候,fft之后可以进行fftshift,ifft 之前也可以进行ifftshift
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值