找回密码
 注册
关于网站域名变更的通知
查看: 394|回复: 2
打印 上一主题 下一主题

MATLAB —— 信号处理工具箱之 ifft 的案例分析

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2019-12-11 09:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

EDA365欢迎您登录!

您需要 登录 才可以下载或查看,没有帐号?注册

x

4 f* M) {) _: z% ~- }5 R

案例分析

       Inverse Transform of Vector

       Padded Inverse Transform of Matrix

       Conjugate Symmetric Vector

  ~; Y  e$ \( Y

$ v( ~$ Q2 E( E: ~! o1 n4 `案例分析
' l5 b) p" v# X( K) ?* u0 y% E
Inverse Transform of Vector
4 P5 q& ^+ V. D  h

& W; r1 z. F  {
  • % 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
    5 i, p+ l; c5 O& Z8 ?! |
  % ^. a7 d% l( W3 F: n! q8 R
8 a, u0 K4 @! J, h. c5 I

, l* f7 ?5 L5 [0 r

5 g  q' T2 S" A- W1 d6 Q' |结果如下:# t8 x( U6 y. j" q+ e4 c% E

7 r- M9 ^& ?9 C0 p/ q6 x1 V- G ifft_vector
& `7 |4 Y( w2 d
: N, K% x! G, [/ C2 ]Y =! N1 n& n. K# V& n0 q( {- ?
2 p1 v* j9 ?% W# Z$ d) c
  1 至 4 列
. l" @* j" ^) @8 y" b3 e: _% u5 \4 o5 l2 W  N& m
  15.0000 + 0.0000i  -2.5000 + 3.4410i  -2.5000 + 0.8123i  -2.5000 - 0.8123i% n" l0 N- _1 D$ F8 _
0 a3 w0 E9 o& `7 C! E
  5 列
7 B5 y$ t* z) t2 Z% i( _' \, V
8 e1 ?9 \$ d2 j2 X# n7 C. F- q  -2.5000 - 3.4410i6 J7 K! Q5 e" G6 |" Q
* @, e3 K4 K+ s0 n5 T4 }0 O+ L
ans =) }/ k1 T$ u* P, o
' a( x( P1 b9 Z& z) @
     1     2     3     4     5$ ~+ B3 G0 d5 S+ j  c
: e( E4 W, B) V4 d( O; W# t
6 M2 y( A/ q" e0 Y0 t
Padded Inverse Transform of Matrix

, m! X, l8 G8 y
  • 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)
      e8 k; X6 w9 }; s
' t+ F! D5 |! s/ P  P

( O4 r" h4 x0 S% B5 k
0 K: H( @2 h) t2 n( Z0 a: l4 q

& _% v) A- ?6 u% l) M( s9 A结果如下:+ D5 A8 a/ j* N
" C3 A4 S* q+ N8 l# }  |
Y =. c1 d& k( n& [8 W$ D

. y& @; \: y' m0 q! b9 H1 \6 V- A    0.8147    0.9134    0.2785    0.9649    0.9572
, J* Q  U' W; z: z    0.9058    0.6324    0.5469    0.1576    0.4854
8 l% I) Q/ L- R/ K2 y    0.1270    0.0975    0.9575    0.9706    0.8003
- M4 {# k, o* {* R4 A0 x2 m
) o, E  D3 b  G9 \X =
- o( ~& V! s9 K8 J2 K. h% G" J5 _9 h- W5 r* L  J
  1 至 4 列& }  i" b$ x: d/ U
( h/ q0 J* t; V8 _# M
   0.4911 + 0.0000i  -0.0224 + 0.2008i   0.1867 - 0.0064i  -0.0133 + 0.1312i
6 b& t. M( L8 Z) H/ f) i( e7 w   0.3410 + 0.0000i   0.0945 + 0.1382i   0.1055 + 0.0593i   0.0106 + 0.0015i2 v+ c  [+ s/ }9 p% B# l0 G
   0.3691 + 0.0000i  -0.1613 + 0.2141i  -0.0038 - 0.1091i  -0.0070 - 0.0253i' Z) j! b! h  |& Q/ M5 f/ q
: m+ m5 x) ?" V
  5 至 8 列
1 x! w+ P7 P1 N/ Q0 ]
" B8 H/ h. H; L, M* u" R# t$ W   0.0215 + 0.0000i  -0.0133 - 0.1312i   0.1867 + 0.0064i  -0.0224 - 0.2008i% J  F' a" B. K. j  N) e9 Q! a
   0.1435 + 0.0000i   0.0106 - 0.0015i   0.1055 - 0.0593i   0.0945 - 0.1382i  a0 @6 z/ w% U! C
   0.1021 + 0.0000i  -0.0070 + 0.0253i  -0.0038 + 0.1091i  -0.1613 - 0.2141i$ W( V! G& Q+ X/ b# H0 i. U0 _
+ ~- V5 v4 J! A7 M* c
ans =
- \. z0 d$ j0 ?8 O; A  E' m" v2 G4 p
     3     8
& Q8 y6 F1 C) e1 Z: T: M
* b$ A1 X3 f: c# _2 ]' {6 m上面的程序是计算矩阵每一行的8点ifft,故结果是每一行的ifft有8个元素,而计算矩阵 Y 每一行的 ifft,关键语句为:, L( I0 L; Z9 u
9 `5 f5 t  `! G. G( M3 V0 S
X = ifft(Y,n,2),里面的2,如果去掉2,则是对矩阵Y的每一列计算ifft,测试如下:" H0 A  M6 p7 a

* l3 x4 G- P; D' M
  • 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)
    . X: q( q& `) a2 N& _% G0 S
  
1 P2 `+ J: Z8 C* {; v8 D  u
4 K; L/ F( ~3 R$ i% x: aY =
& _6 R' Q' P9 x8 z. B& S/ G; p5 J3 Z/ T0 X, B3 K# F; s
    0.1419    0.7922    0.0357    0.6787    0.3922
$ x& t% I6 R6 @$ E0 U" z    0.4218    0.9595    0.8491    0.7577    0.6555
# N' V) b. \0 a2 C, \    0.9157    0.6557    0.9340    0.7431    0.1712
1 R! U# Z; s  [2 ^
6 M! D& K% L- L* Q8 ~X =
/ k0 O9 G* O* e/ D2 B8 K6 U1 f- L' {  J# O2 A" \
  1 至 4 列
2 U1 s' H' Q5 e' W/ |
: D8 f- X1 T0 e+ }+ w+ K% \! h   0.1849 + 0.0000i   0.3009 + 0.0000i   0.2274 + 0.0000i   0.2725 + 0.0000i
; U8 S/ T' X8 \6 q   0.0550 + 0.1517i   0.1838 + 0.1668i   0.0795 + 0.1918i   0.1518 + 0.1599i
. ~8 _& g" p5 @" F( O  -0.0967 + 0.0527i   0.0171 + 0.1199i  -0.1123 + 0.1061i  -0.0080 + 0.0947i5 O( N2 S. X) \2 r% ?% W# M" d
  -0.0195 - 0.0772i   0.0142 + 0.0028i  -0.0706 - 0.0417i   0.0179 - 0.0259i
2 Z0 B. ^8 a- F% V1 P   0.0795 + 0.0000i   0.0611 + 0.0000i   0.0151 + 0.0000i   0.0830 + 0.0000i6 O1 B& x' A% C2 j8 g. }
  -0.0195 + 0.0772i   0.0142 - 0.0028i  -0.0706 + 0.0417i   0.0179 + 0.0259i
: }9 ?( }4 G; N5 ?7 Y  -0.0967 - 0.0527i   0.0171 - 0.1199i  -0.1123 - 0.1061i  -0.0080 - 0.0947i
/ a+ e6 H  I0 k1 e   0.0550 - 0.1517i   0.1838 - 0.1668i   0.0795 - 0.1918i   0.1518 - 0.1599i9 {# C! k$ M# k% u% e4 K

1 I6 K; Y+ `; {  5 列9 d- l/ i9 l* K5 y) x; p; ~

% j9 _8 B! d( I# R- A7 M6 `9 L   0.1524 + 0.0000i+ y; H/ v, a" Y: G. n+ G
   0.1070 + 0.0793i
4 y1 N! w: J# y4 u9 Y; @   0.0276 + 0.0819i
2 O2 a. J, w$ s" p- A( b& C  -0.0089 + 0.0365i: X0 d+ v+ Z8 T6 y+ q
  -0.0115 + 0.0000i9 }' r) Q! ?$ J# s- n
  -0.0089 - 0.0365i$ g# M( _( A% @! W6 z) X! e+ i
   0.0276 - 0.0819i
6 Q" X% W& n8 I7 [+ Z* ~; s   0.1070 - 0.0793i
8 F7 ?& |  h) x- m
; F* M2 X# n- O  o: Sans =
( E, n! G. m2 U1 y& I) q: K) S
" {+ ]" ^" D! h     8     5
+ c$ M/ j# e3 \# P/ m, \ 1 O: ?% n  a) v! X: H3 w7 @( |

0 h* ]$ n. B8 J" g6 ?- K4 a. t# LConjugate Symmetric Vector
! L: \1 U- o- E5 @

, i0 Q6 Q" J! a# \, _For nearly conjugate symmetric vectors, you can compute the inverse Fourier transform faster by specifying the 'symmetric' option,
( x8 x( X$ H/ M# `- xwhich also ensures that the output is real. Nearly conjugate symmetric data can arise when computations introduce round-off error.+ Z* ^9 s1 Z! v- c

  y$ W- E7 V6 J3 e! PCreate a vector Y that is nearly conjugate symmetric and compute its inverse Fourier transform. 3 W+ u/ }: n- A% _0 u3 a- z
Then, compute the inverse transform specifying the 'symmetric' option, which eliminates the nearly 0 imaginary parts.! B; W- s4 |& N2 `- N

  b& o( I( d& i+ D+ g' V7 a0 }0 X对于近似共轭对称矢量,您可以通过指定“symmetric”选项来更快地计算逆傅里叶变换,这也确保了输出是真实的。 当计算引入舍入误差时,可能出现几乎共轭的对称数据。
$ V' Z' ?7 G8 G. \! z! p; T1 }" A1 M: |: ~: t
创建几乎共轭对称的向量Y并计算其逆傅里叶变换。然后,计算指定'对称'选项的逆变换,它消除了近0虚部。
  j& Y% n( F6 ^" n$ t: J* O
/ U3 {$ ?$ Q+ i
  • 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 ⋯9 G5 i/ J% n  p) Q! M. V
   ! u0 h/ b) \* T0 F3 N( g+ f& W3 k

) W6 O3 g3 h" Q/ b+ _
7 x6 B- S; ~0 b2 d

, ?4 p. E" y+ _- B. Q7 N. o结果如下:
( Z" x1 P$ U) G
; T. A2 B' j9 A8 @% v5 HY =
6 C9 z* T  P( N6 ~8 }( \! w9 w5 K
' A5 Y. @9 c, t4 @4 j    1.0000    2.0000    3.0000    4.0000    4.0000    3.0000    2.0000
9 \+ u6 E0 i9 x4 E: H: f1 b8 r
: D3 \+ Y. N4 v' ~3 HX =% a% L8 r* n" R$ u& N

* d$ ?, g# C& c, }" n  1 至 4 列  K( {9 e3 w' o
$ m, r* O7 f) D
   2.7143 + 0.0000i  -0.7213 + 0.0000i  -0.0440 - 0.0000i  -0.0919 + 0.0000i
4 J  l3 k3 m( N' z/ |3 @& Y6 p* l* `! y7 H+ H
  5 至 7 列
# L% s& c, u5 \$ y% g" _: K
0 i. d9 }$ a% V' X  -0.0919 - 0.0000i  -0.0440 + 0.0000i  -0.7213 - 0.0000i
9 S  X! s  g) c3 B
" k5 @+ }. K1 e2 K: L% b. @6 C8 r0 `Xsym =& D5 l9 e( J: H6 g, H0 _! ^

; z4 x* s, i( N" i4 n: \1 J    2.7143   -0.7213   -0.0440   -0.0919   -0.0919   -0.0440   -0.7213
5 f5 S+ v/ B: Y! y! b

! t: f/ K% G; V' z& v
( e# o" R/ ~7 {3 q
6 T: k# Q3 e9 R* U" `0 u
3 a* N0 F6 r, v0 t1 E  b8 d

$ U9 P, v# E1 T  ~5 S/ Q
) U: x" P8 }% l- R
8 `6 `. |4 T5 N( B
/ ?& |" F5 S+ b2 f0 k
) c: ~0 R* t7 @
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

推荐内容上一条 /1 下一条

EDA365公众号

关于我们|手机版|EDA365电子论坛网 ( 粤ICP备18020198号-1 )

GMT+8, 2025-11-24 01:22 , Processed in 0.140625 second(s), 23 queries , Gzip On.

深圳市墨知创新科技有限公司

地址:深圳市南山区科技生态园2栋A座805 电话:19926409050

快速回复 返回顶部 返回列表