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

版权声明:本博客内容来自于个人学习过程中的总结,参考了互联网以及书本、论文等上的内容,仅供学习交流使用,如有侵权,请联系我会重写!转载请注明地址! https://blog.csdn.net/Reborn_Lee/article/details/83065742

这篇博文和上篇博文对应:【 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

% The Fourier transform and its inverse convert between data sampled in time and space and data sampled in frequency.
% 
% Create a vector and compute its Fourier transform.

X = [1 2 3 4 5];
Y = fft(X)
% Y = 1×5 complex
% 
%   15.0000 + 0.0000i  -2.5000 + 3.4410i  -2.5000 + 0.8123i  -2.5000 - 0.8123i  -2.5000 - 3.4410i ⋯
% 
% Compute the inverse transform of Y, which is the same as the original vector X.

ifft(Y)
% ans = 1×5
% 
%      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

clc
clear
close all
% The ifft function allows you to control the size of the transform.
% 
% Create a random 3-by-5 matrix and compute the 8-point inverse Fourier transform of each row.
% Each row of the result has length 8.

Y = rand(3,5)
n = 8;
X = ifft(Y,n,2)
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,测试如下:

clc
clear
close all
% The ifft function allows you to control the size of the transform.
% 
% Create a random 3-by-5 matrix and compute the 8-point inverse Fourier transform of each row.
% Each row of the result has length 8.

Y = rand(3,5)
n = 8;
X = ifft(Y,n)
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虚部。

clc
clear
close all
% 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.

Y = [1 2:4+eps(4) 4:-1:2]
% Y = 1×7
% 
%     1.0000    2.0000    3.0000    4.0000    4.0000    3.0000    2.0000 ⋯

X = ifft(Y)
% X = 1×7 complex
% 
%    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 ⋯

Xsym = ifft(Y,'symmetric')
% Xsym = 1×7
% 
%     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 (浮点相对精度)简介

猜你喜欢

转载自blog.csdn.net/Reborn_Lee/article/details/83065742