繁体   English   中英

犰狳 ifftshift 和 ifft c++

[英]Armadillo ifftshift and ifft c++

有谁知道如何为犰狳中的矩阵做 ifftshift + ifft(按行)?

我在 matlab 做过: ifft(ifftshift(mat,2),[],2) ; 其中 mat 是矩阵 (3,18000);

我已经尝试在 C++ 中做类似的事情:

arma::mat v3(3,18000); ... filled with the same values from Matlab ... 

static arma::cx_mat ifftshift(arma::cx_mat Axx)
{
    return arma::shift(arma::shift(Axx, -ceil(Axx.n_rows/2), 0), -ceil(Axx.n_cols/2), 1);
}

arma::ifft( ifftshift(v3).t() ).t();

结果与 Matlab 中的结果不同。

问题很可能是您的ifftshift()在两个维度上移动, matlab 命令仅在第二(行)维度ifftshift(mat,2)中移动。 如果您想要相同的行为,请尝试删除 function 中的一个班次
return arma::shift(Axx,-ceil(Axx.n_cols/2),1)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM