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

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

[复制链接]

该用户从未签到

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

EDA365欢迎您登录!

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

x
: `8 i) N2 l* D! l

案例分析

       Inverse Transform of Vector

       Padded Inverse Transform of Matrix

       Conjugate Symmetric Vector

+ e' E" P# w% r% N9 n  j* R- m5 M) ?/ D

" _+ Z0 j, b$ T- [* ?2 w* l案例分析

6 ?6 s" c1 j) c8 ^0 w9 [Inverse Transform of Vector
5 u* |0 x5 a( y/ O7 b, {

# Y% R9 p7 M7 }) z4 U
  • % 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     51 v, k0 f1 p/ y
  
: W' s: U- o: G$ y# @6 q; y1 p! K

* [+ l5 ~$ V6 n2 v
% ^# _/ E: |7 p: ^( _

) p) H. |5 i' g4 R& |. h$ S结果如下:% H* i. m, t! K" m; U9 i! G
7 b% |( Y0 f. A1 e0 R
ifft_vector
/ X& o$ A3 |6 x5 ^. v  N, O1 g6 o# v* G
Y =6 h2 W2 J) t' z* Q
/ {$ ~2 y" r3 X/ O
  1 至 4 列. V9 [1 i' @& I
7 }0 v7 O/ Q, Z7 A& i/ O0 R& l# k
  15.0000 + 0.0000i  -2.5000 + 3.4410i  -2.5000 + 0.8123i  -2.5000 - 0.8123i. b( u( d& r9 z4 O% W' ]# C  Q6 {/ E

, y. u1 @$ N0 p5 S* x% `5 f  5 列
; F) F# a0 U! Y0 e5 m; a
4 J5 P. @1 _& @: c6 L. Y" Y  -2.5000 - 3.4410i
$ A/ ]2 s  {5 s( ~7 X; A8 \6 O. {% |2 |1 A" h0 d/ p- M  z5 J, c
ans =
( S. G2 X: q7 U
8 J8 G7 K1 t! D$ W- t0 y     1     2     3     4     5
% ]/ `% V8 D1 ?4 F7 `4 ~( @$ A- U/ n6 S5 [. I) d( r6 r
% K9 h7 _% y' w* Y" ?9 p+ A
Padded Inverse Transform of Matrix
. m- r- H7 O& p
  • 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)
    4 j/ E: D4 V& B9 [" `
1 s9 J: a9 S2 d/ H8 O: ^% c

; T0 ]7 }7 w0 T; a/ W3 v5 a) R) q  B

& U1 K# p1 F! i5 y2 o3 u结果如下:
" i- p: P6 d/ {% E8 J; T$ b. B! a) x, {+ r7 T; z  t
Y =
: k( H  S. F; `2 D, r' @/ ~- g# l2 J2 H3 z$ E& w
    0.8147    0.9134    0.2785    0.9649    0.9572
. _- \5 z3 m, {6 O: u' O2 X  S    0.9058    0.6324    0.5469    0.1576    0.4854
# f) o$ P# j+ Y- q! {) Z    0.1270    0.0975    0.9575    0.9706    0.8003
4 L" Q7 o& C+ `3 l$ R+ s5 I9 b
' k' V/ O& [  y. k6 uX =+ T! S5 h" x- o0 E) G( ~6 Y
8 x  F) q$ l) I# f
  1 至 4 列' @; F7 Q( P6 G6 O

7 Y' P* r! h+ K& T* g, j. i) [   0.4911 + 0.0000i  -0.0224 + 0.2008i   0.1867 - 0.0064i  -0.0133 + 0.1312i( G7 p- p- K9 k( Y0 a/ m
   0.3410 + 0.0000i   0.0945 + 0.1382i   0.1055 + 0.0593i   0.0106 + 0.0015i
# E& \( _) K/ O* r3 l   0.3691 + 0.0000i  -0.1613 + 0.2141i  -0.0038 - 0.1091i  -0.0070 - 0.0253i. L+ G, T7 G, ?+ D* l' G4 P7 i- m
+ ?* g, Y* D' x7 X1 @
  5 至 8 列
1 T( ^3 Q! f: Z6 X5 P2 o) \0 j$ ]+ X; N* F
   0.0215 + 0.0000i  -0.0133 - 0.1312i   0.1867 + 0.0064i  -0.0224 - 0.2008i; @/ B' s5 J8 X5 y' W
   0.1435 + 0.0000i   0.0106 - 0.0015i   0.1055 - 0.0593i   0.0945 - 0.1382i3 k' y' n: Z4 v8 E5 {2 I: R
   0.1021 + 0.0000i  -0.0070 + 0.0253i  -0.0038 + 0.1091i  -0.1613 - 0.2141i1 ~  U5 {* u2 Z4 U  \/ h" P3 J
# ^1 [2 N8 m2 ]
ans =
. K" {7 t  Z1 y! N6 q
7 A& b) Y5 v7 [' ~. D2 E/ F$ a     3     8
6 Z8 v6 {' }  U* o* m2 `9 c# j
& s. ?: }) M/ M" t- I. j上面的程序是计算矩阵每一行的8点ifft,故结果是每一行的ifft有8个元素,而计算矩阵 Y 每一行的 ifft,关键语句为:8 F6 S2 G2 R0 s  w6 g! R

& ?0 N- h3 n' G% {1 }X = ifft(Y,n,2),里面的2,如果去掉2,则是对矩阵Y的每一列计算ifft,测试如下:4 G/ }9 ^% I( f' ^6 B/ J$ Y, @5 w
2 _9 F: V- |: Q4 o8 m4 z+ H
  • 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)9 F% e* j4 w- ^# I" \) e
  
; D1 ?$ j, Z0 Z: q0 Y
$ T; J# I) I( N. g: Q4 X3 w- }% }9 h5 F. \Y =$ j2 u) r- S: B& a" U/ J% ?8 {

+ x* z% }  K2 m    0.1419    0.7922    0.0357    0.6787    0.3922- ?2 m+ z7 a! A1 F
    0.4218    0.9595    0.8491    0.7577    0.6555
2 ^( g; O& V3 m" ~: B( I    0.9157    0.6557    0.9340    0.7431    0.1712) a5 Z, o; \, U; ]' [) R3 K; B
3 D+ z. T6 X3 S- C& G3 o
X =2 y0 i* |3 [7 M

0 S( H2 P9 A; j! }' F' R  1 至 4 列% r0 A% Q8 J: @( Q, P
/ V0 a+ q. ?5 y& O9 I+ t
   0.1849 + 0.0000i   0.3009 + 0.0000i   0.2274 + 0.0000i   0.2725 + 0.0000i; [) h4 C- b% j* h
   0.0550 + 0.1517i   0.1838 + 0.1668i   0.0795 + 0.1918i   0.1518 + 0.1599i& _  N9 J4 p6 K( f, {- L1 B
  -0.0967 + 0.0527i   0.0171 + 0.1199i  -0.1123 + 0.1061i  -0.0080 + 0.0947i
5 r3 `5 H, \; P0 Q  -0.0195 - 0.0772i   0.0142 + 0.0028i  -0.0706 - 0.0417i   0.0179 - 0.0259i& Q" y' Q0 f% I, |6 `! m" H
   0.0795 + 0.0000i   0.0611 + 0.0000i   0.0151 + 0.0000i   0.0830 + 0.0000i1 V, A5 k8 N% B4 D3 d
  -0.0195 + 0.0772i   0.0142 - 0.0028i  -0.0706 + 0.0417i   0.0179 + 0.0259i
. A/ l  C* B# P' }4 w0 O0 Y  -0.0967 - 0.0527i   0.0171 - 0.1199i  -0.1123 - 0.1061i  -0.0080 - 0.0947i
/ v% \9 p# d" g- d) G; o- w$ D3 t   0.0550 - 0.1517i   0.1838 - 0.1668i   0.0795 - 0.1918i   0.1518 - 0.1599i0 r7 v3 n! v6 j& E5 V$ {2 j

8 Q2 y  g! V# D# x" G  5 列
5 U6 {; C$ P1 Z* a$ d& M, a, S. J1 D$ {2 g- B2 O
   0.1524 + 0.0000i
& x5 u5 t1 k& i6 V   0.1070 + 0.0793i
  j8 O/ M( @3 J/ x$ D/ z   0.0276 + 0.0819i
7 Q# J  h+ O5 ]6 ^  -0.0089 + 0.0365i
+ o- F) k6 ]6 ~9 ~& r, q  -0.0115 + 0.0000i
% W. e2 @1 K, C  e  G/ B- @& m  -0.0089 - 0.0365i9 V5 ?3 O3 k, \" ?
   0.0276 - 0.0819i1 `) E6 ~" W+ ?# ?
   0.1070 - 0.0793i
" i8 y+ I  A! u& V  [, ^" M
% y1 }+ R4 u! ?, L2 z( F7 Y6 N4 jans =
1 w; E% m% i% {* i: U* W
( z' S! Y. X& ~8 I3 H, J! Z# O0 _     8     5
9 R4 f# u+ R2 e) K) ?( Z # S  l3 n5 t( x
8 D2 J1 C6 V0 b% k/ \
Conjugate Symmetric Vector

: f& `  o( m* [! a# M: ]3 ~
2 q6 L) c9 ?& ^5 |9 PFor nearly conjugate symmetric vectors, you can compute the inverse Fourier transform faster by specifying the 'symmetric' option,
8 ]: M/ l8 \; ~0 Q; Uwhich also ensures that the output is real. Nearly conjugate symmetric data can arise when computations introduce round-off error.
+ z  s2 ]2 A7 k! y  a8 Y5 i0 e
Create a vector Y that is nearly conjugate symmetric and compute its inverse Fourier transform. # u% l* \. |: u
Then, compute the inverse transform specifying the 'symmetric' option, which eliminates the nearly 0 imaginary parts.
% X" x, F: T: k6 U, z3 g
3 Z! V% J- j% r$ b' k8 ]" Z对于近似共轭对称矢量,您可以通过指定“symmetric”选项来更快地计算逆傅里叶变换,这也确保了输出是真实的。 当计算引入舍入误差时,可能出现几乎共轭的对称数据。
: L# _9 _  h" y
" M  U! Y4 i4 P& Q0 F4 o( K创建几乎共轭对称的向量Y并计算其逆傅里叶变换。然后,计算指定'对称'选项的逆变换,它消除了近0虚部。  |5 r! v% j) x! I- v
; p7 {* i" y- R
  • 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 ⋯
    ! U- b* D. C# M4 }
   " V; Q) z, N( {+ o6 C  W0 E

& S4 X( Z4 \* M; v" P( b0 v' H& S# K# y. }& ^! w# b/ \

8 R1 C, ?  ~7 y" F8 P( D! [结果如下:
6 \$ e# [: w% f& u8 h6 M# M( G& r6 x$ y
Y =' h6 [" H% Q( v, }  T! V

# o) E) }8 L% j) |$ B& z    1.0000    2.0000    3.0000    4.0000    4.0000    3.0000    2.0000
7 j7 ]2 o# J) @/ v1 @
; j( A* E$ f2 {8 _X =
9 ~" H8 u2 z/ m* H$ {& C  w) Z1 \6 f" \2 |9 m& H& ^
  1 至 4 列0 J" C5 ]$ @% ?
% I1 W3 \, }; i+ r: E% w+ b& g* q
   2.7143 + 0.0000i  -0.7213 + 0.0000i  -0.0440 - 0.0000i  -0.0919 + 0.0000i/ W! U1 g& Z% n( d

# Z" ]9 Y2 y! T1 V  5 至 7 列2 U, ]0 D" r' B. s, H0 j' X& y* K& _- G
, [2 L4 J1 p+ @: L# p% s' }5 A
  -0.0919 - 0.0000i  -0.0440 + 0.0000i  -0.7213 - 0.0000i5 D  P8 r2 K/ X9 ~* g, Z; G* v" ]
, _$ L) e9 K0 \( [/ d- J( e
Xsym =
" ^+ k2 _& \+ H. i) ?! O4 ]3 X6 A0 a- \1 g0 u
    2.7143   -0.7213   -0.0440   -0.0919   -0.0919   -0.0440   -0.7213

3 B8 A" ^8 b$ b! \! Q9 x5 q/ X  ~  R+ I
1 @. T! M  A) Z. `2 ^* p5 v

( a9 e: L4 `) F4 t- c
# `0 u' k1 n9 X# a' o$ a

8 U4 j# j- @- ?$ E( P
0 f% a! V" {/ q1 y

/ `. H% d' X" m" b, t1 E2 U3 n( Q
3 v% l, n" K% l0 ^* d& B

! y: [/ w: t# |+ }
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

EDA365公众号

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

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

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

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

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