【 MATLAB 】信号处理工具箱之 ifft 简介及案例分析

举报
李锐博恩 发表于 2021/07/15 06:59:09 2021/07/15
【摘要】 这篇博文和上篇博文对应:【 MATLAB 】信号处理工具箱之fft简介及案例分析 目录 ifft Syntax Description 案例分析 Inverse Transform of Vector Padded Inverse Transform of Matrix Conjugate Symmetric Vector ifft Inverse fa...

这篇博文和上篇博文对应:【 MATLAB 】信号处理工具箱之fft简介及案例分析

目录

ifft

Syntax

Description

案例分析

Inverse Transform of Vector

Padded Inverse Transform of Matrix

Conjugate Symmetric Vector


ifft

Inverse fast Fourier transform



Syntax

X = ifft(Y)

X = ifft(Y,n)

X = ifft(Y,n,dim)

X = ifft(___,symflag)



Description

X = ifft(Y)

X = ifft(Y) computes the inverse discrete Fourier transform of Y using a fast Fourier transform algorithm. X is the same size as Y.

  • If Y is a vector, then ifft(Y) returns the inverse transform of the vector.

  • If Y is a matrix, then ifft(Y) returns the inverse transform of each column of the matrix.

  • If Y is a multidimensional array, then ifft(Y) treats the values along the first dimension whose size does not equal 1 as vectors and returns the inverse transform of each vector.

本想翻译一下的,但是手册里面的英文描述的太清晰了,单词也很简单,所以就这样直接看吧。


X = ifft(Y,n) returns the n-point inverse Fourier transform of Y by padding Y with trailing zeros to length n.

X = ifft(Y,n,dim) returns the inverse Fourier transform along the dimension dim. For example, if Y is a matrix, then ifft(Y,n,2) returns the n-point inverse transform of each row.

X = ifft(Y,n,dim)沿维度dim返回逆傅立叶变换。 例如,如果Y是矩阵,则ifft(Y,n,2)返回每行的n点逆变换。

X = ifft(___,symflag) specifies the symmetry of Y. For example, ifft(Y,'symmetric') treats Y as conjugate symmetric.

X = ifft(___,symflag)指定Y的对称性。例如,ifft(Y,'symmetric')将Y视为共轭对称。



案例分析

Inverse Transform of Vector


  
  1. % The Fourier transform and its inverse convert between data sampled in time and space and data sampled in frequency.
  2. %
  3. % Create a vector and compute its Fourier transform.
  4. X = [1 2 3 4 5];
  5. Y = fft(X)
  6. % Y = 1×5 complex
  7. %
  8. % 15.0000 + 0.0000i -2.5000 + 3.4410i -2.5000 + 0.8123i -2.5000 - 0.8123i -2.5000 - 3.4410i
  9. %
  10. % Compute the inverse transform of Y, which is the same as the original vector X.
  11. ifft(Y)
  12. % ans = 1×5
  13. %
  14. % 1 2 3 4 5

结果如下:

 ifft_vector

Y =

  1 至 4 列

  15.0000 + 0.0000i  -2.5000 + 3.4410i  -2.5000 + 0.8123i  -2.5000 - 0.8123i

  5 列

  -2.5000 - 3.4410i


ans =

     1     2     3     4     5


Padded Inverse Transform of Matrix


  
  1. clc
  2. clear
  3. close all
  4. % The ifft function allows you to control the size of the transform.
  5. %
  6. % Create a random 3-by-5 matrix and compute the 8-point inverse Fourier transform of each row.
  7. % Each row of the result has length 8.
  8. Y = rand(3,5)
  9. n = 8;
  10. X = ifft(Y,n,2)
  11. size(X)

结果如下:

Y =

    0.8147    0.9134    0.2785    0.9649    0.9572
    0.9058    0.6324    0.5469    0.1576    0.4854
    0.1270    0.0975    0.9575    0.9706    0.8003


X =

  1 至 4 列

   0.4911 + 0.0000i  -0.0224 + 0.2008i   0.1867 - 0.0064i  -0.0133 + 0.1312i
   0.3410 + 0.0000i   0.0945 + 0.1382i   0.1055 + 0.0593i   0.0106 + 0.0015i
   0.3691 + 0.0000i  -0.1613 + 0.2141i  -0.0038 - 0.1091i  -0.0070 - 0.0253i

  5 至 8 列

   0.0215 + 0.0000i  -0.0133 - 0.1312i   0.1867 + 0.0064i  -0.0224 - 0.2008i
   0.1435 + 0.0000i   0.0106 - 0.0015i   0.1055 - 0.0593i   0.0945 - 0.1382i
   0.1021 + 0.0000i  -0.0070 + 0.0253i  -0.0038 + 0.1091i  -0.1613 - 0.2141i


ans =

     3     8

上面的程序是计算矩阵每一行的8点ifft,故结果是每一行的ifft有8个元素,而计算矩阵 Y 每一行的 ifft,关键语句为:

X = ifft(Y,n,2),里面的2,如果去掉2,则是对矩阵Y的每一列计算ifft,测试如下:


  
  1. clc
  2. clear
  3. close all
  4. % The ifft function allows you to control the size of the transform.
  5. %
  6. % Create a random 3-by-5 matrix and compute the 8-point inverse Fourier transform of each row.
  7. % Each row of the result has length 8.
  8. Y = rand(3,5)
  9. n = 8;
  10. X = ifft(Y,n)
  11. size(X)

 

Y =

    0.1419    0.7922    0.0357    0.6787    0.3922
    0.4218    0.9595    0.8491    0.7577    0.6555
    0.9157    0.6557    0.9340    0.7431    0.1712


X =

  1 至 4 列

   0.1849 + 0.0000i   0.3009 + 0.0000i   0.2274 + 0.0000i   0.2725 + 0.0000i
   0.0550 + 0.1517i   0.1838 + 0.1668i   0.0795 + 0.1918i   0.1518 + 0.1599i
  -0.0967 + 0.0527i   0.0171 + 0.1199i  -0.1123 + 0.1061i  -0.0080 + 0.0947i
  -0.0195 - 0.0772i   0.0142 + 0.0028i  -0.0706 - 0.0417i   0.0179 - 0.0259i
   0.0795 + 0.0000i   0.0611 + 0.0000i   0.0151 + 0.0000i   0.0830 + 0.0000i
  -0.0195 + 0.0772i   0.0142 - 0.0028i  -0.0706 + 0.0417i   0.0179 + 0.0259i
  -0.0967 - 0.0527i   0.0171 - 0.1199i  -0.1123 - 0.1061i  -0.0080 - 0.0947i
   0.0550 - 0.1517i   0.1838 - 0.1668i   0.0795 - 0.1918i   0.1518 - 0.1599i

  5 列

   0.1524 + 0.0000i
   0.1070 + 0.0793i
   0.0276 + 0.0819i
  -0.0089 + 0.0365i
  -0.0115 + 0.0000i
  -0.0089 - 0.0365i
   0.0276 - 0.0819i
   0.1070 - 0.0793i


ans =

     8     5
 


Conjugate Symmetric Vector

For nearly conjugate symmetric vectors, you can compute the inverse Fourier transform faster by specifying the 'symmetric' option, 
which also ensures that the output is real. Nearly conjugate symmetric data can arise when computations introduce round-off error.

Create a vector Y that is nearly conjugate symmetric and compute its inverse Fourier transform. 
Then, compute the inverse transform specifying the 'symmetric' option, which eliminates the nearly 0 imaginary parts.

对于近似共轭对称矢量,您可以通过指定“symmetric”选项来更快地计算逆傅里叶变换,这也确保了输出是真实的。 当计算引入舍入误差时,可能出现几乎共轭的对称数据。

创建几乎共轭对称的向量Y并计算其逆傅里叶变换。然后,计算指定'对称'选项的逆变换,它消除了近0虚部。


  
  1. clc
  2. clear
  3. close all
  4. % For nearly conjugate symmetric vectors, you can compute the inverse Fourier transform faster by specifying the 'symmetric' option,
  5. % which also ensures that the output is real. Nearly conjugate symmetric data can arise when computations introduce round-off error.
  6. %
  7. % Create a vector Y that is nearly conjugate symmetric and compute its inverse Fourier transform.
  8. % Then, compute the inverse transform specifying the 'symmetric' option, which eliminates the nearly 0 imaginary parts.
  9. Y = [1 2:4+eps(4) 4:-1:2]
  10. % Y = 1×7
  11. %
  12. % 1.0000 2.0000 3.0000 4.0000 4.0000 3.0000 2.0000
  13. X = ifft(Y)
  14. % X = 1×7 complex
  15. %
  16. % 2.7143 + 0.0000i -0.7213 + 0.0000i -0.0440 - 0.0000i -0.0919 + 0.0000i -0.0919 - 0.0000i -0.0440 + 0.0000i -0.7213 - 0.0000i
  17. Xsym = ifft(Y,'symmetric')
  18. % Xsym = 1×7
  19. %
  20. % 2.7143 -0.7213 -0.0440 -0.0919 -0.0919 -0.0440 -0.7213

结果如下:

Y =

    1.0000    2.0000    3.0000    4.0000    4.0000    3.0000    2.0000


X =

  1 至 4 列

   2.7143 + 0.0000i  -0.7213 + 0.0000i  -0.0440 - 0.0000i  -0.0919 + 0.0000i

  5 至 7 列

  -0.0919 - 0.0000i  -0.0440 + 0.0000i  -0.7213 - 0.0000i


Xsym =

    2.7143   -0.7213   -0.0440   -0.0919   -0.0919   -0.0440   -0.7213

最后一个例子中用到了eps,关于eps的介绍见博文:

【 MATLAB 】eps (浮点相对精度)简介

文章来源: reborn.blog.csdn.net,作者:李锐博恩,版权归原作者所有,如需转载,请联系作者。

原文链接:reborn.blog.csdn.net/article/details/83065742

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。