Armadillo使用介绍(十二):fft / ifft

fft / ifft

用途:fft / ifft函数用于一维快速傅里叶变换/快速傅里叶逆变换
该函数重载有cx_mat Y = fft( X )、cx_mat Y = fft( X, n )、cx_mat Z = ifft( cx_mat Y )、cx_mat Z = ifft( cx_mat Y, n )
类型:普通函数
隶属:Signal & Image Processing

1、fft(): fast Fourier transform of a vector or matrix (real or complex)

2、ifft(): inverse fast Fourier transform of a vector or matrix (complex only)

3、If given a matrix, the transform is done on each column vector of the matrix

4、The optional n argument specifies the transform length:
    if n is larger than the length of the input vector, a zero-padded version of the vector is used
    if n is smaller than the length of the input vector, only the first n elements of the vector are used

5、If n is not specified, the transform length is the same as the length of the input vector

6、注意: the transform is fastest when the transform length is a power of 2, eg. 64, 128, 256, 512, 1024, ...

7、The implementation of the transform in this version is preliminary; it is not yet fully optimised

示例代码如下:

	vec X = randu<vec>(10);
	cx_vec Y = fft(X, 8);
	cx_vec Z = ifft(Y, 8);

	X.print("X:");
	Y.print("Y:");
	Z.print("Z:");

运行结果:

Armadillo version: 9.900.1 (Nocturnal Misbehaviour)
X:
   0.0013
   0.1933
   0.5850
   0.3503
   0.8228
   0.1741
   0.7105
   0.3040
   0.0914
   0.1473
Y:
  (+3.141e+000,+0.000e+000)
  (-8.408e-001,+7.916e-002)
  (-4.714e-001,+2.868e-001)
  (-8.024e-001,-1.718e-001)
  (+1.098e+000,+0.000e+000)
  (-8.024e-001,+1.718e-001)
  (-4.714e-001,-2.868e-001)
  (-8.408e-001,-7.916e-002)
Z:
  (+1.268e-003,+0.000e+000)
  (+1.933e-001,-8.132e-019)
  (+5.850e-001,+0.000e+000)
  (+3.503e-001,-1.789e-018)
  (+8.228e-001,+0.000e+000)
  (+1.741e-001,+9.595e-018)
  (+7.105e-001,+0.000e+000)
  (+3.040e-001,-6.993e-018)
请按任意键继续. . .
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 6
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值