正弦波をEuler法で近似積分した結果の周波数スペクトラム

はじめに

物理系をディジタル計算機で制御するにあたり、積分をEuler法で近似することがある。本記事では正弦波をEuler法で近似的に積分した際の出力の窓関数付きFourier変換を導出し、高周波領域での位相変化、エイリアシングについて考察する。

\[ % to cope with definition mismatch between MathJax and LaTeX \newcommand{\coloneq}{\mathrel{:=}} \newcommand{\eqcolon}{\mathrel{=:}} % general purpose \newcommand{\ctext}[1]{\raise0.2ex\hbox{\textcircled{\scriptsize{#1}}}} % mathematics % general purpose \DeclarePairedDelimiterX{\parens}[1]{\lparen}{\rparen}{#1} \DeclarePairedDelimiterX{\braces}[1]{\lbrace}{\rbrace}{#1} \DeclarePairedDelimiterX{\bracks}[1]{\lbrack}{\rbrack}{#1} \DeclarePairedDelimiterX{\verts}[1]{|}{|}{#1} \DeclarePairedDelimiterX{\Verts}[1]{\|}{\|}{#1} \DeclarePairedDelimiterX{\setComprehension}[2]{\lbrace}{\rbrace}{#1\,\delimsize\vert\,#2} \newcommand{\as}{{\quad\textrm{as}\quad}} \newcommand{\st}{{\textrm{ s.t. }}} \newcommand{\naturalNumbers}{\mathbb{N}} \newcommand{\integers}{\mathbb{Z}} \newcommand{\rationalNumbers}{\mathbb{Q}} \newcommand{\realNumbers}{\mathbb{R}} \newcommand{\nonNegRealNumbers}{\mathbb{R}_{\geq 0}} \newcommand{\posRealNumbers}{\mathbb{R}_{> 0}} \newcommand{\complexNumbers}{\mathbb{C}} \newcommand{\field}{\mathbb{F}} \newcommand{\EuclideanSpace}{\mathbb{E}} \newcommand{\argmax}{\operatorname*{arg~max}} \newcommand{\argmin}{\operatorname*{arg~min}} % set theory \newcommand{\range}[2]{\braces*{#1,\dotsc,#2}} \renewcommand{\complement}{\mathrm{c}} \newcommand{\ind}[2]{\mathbbm{1}_{#1}\parens*{#2}} \newcommand{\indII}[1]{\mathbbm{1}\braces*{#1}} % number theory \newcommand{\abs}[1]{\verts*{#1}} \newcommand{\combi}[2]{{_{#1}\mathrm{C}_{#2}}} \newcommand{\perm}[2]{{_{#1}\mathrm{P}_{#2}}} \newcommand{\GaloisField}{\mathrm{GF}} % real analysis \newcommand{\NapierE}{\mathrm{e}} \newcommand{\sgn}{\operatorname{sgn}} % sign function \newcommand{\rect}{\operatorname{rect}} % rectangular function \newcommand{\cl}{\operatorname{cl}} % closure of a set \newcommand{\img}{\operatorname{im}} % image of a function \newcommand{\dom}{\operatorname{dom}} % domain of a function \newcommand{\LittleO}[2]{\underset{#1}{o}\parens*{#2}} % little-o notation \newcommand{\norm}[1]{\Verts*{#1}} % norm of a vector or function \newcommand{\floor}[1]{\left\lfloor #1\right\rfloor} \newcommand{\ceil}[1]{\left\lceil#1\right\rceil} \newcommand{\sinc}{\operatorname{sinc}} \newcommand{\nrmSinc}{\operatorname{nsinc}} % normalized sinc function \newcommand{\erf}{\operatorname{erf}} % inverse trigonometric functions \newcommand{\asin}{\operatorname{Sin}^{-1}} \newcommand{\acos}{\operatorname{Cos}^{-1}} \newcommand{\atan}{\operatorname{Tan}^{-1}} % derivative \newcommand{\deriv}[3]{\frac{\mathrm{d}^{#3}#1}{\mathrm{d}{#2}^{#3}}} \newcommand{\derivLong}[3]{\frac{\mathrm{d}^{#3}}{\mathrm{d}{#2}^{#3}}#1} \newcommand{\partDeriv}[3]{\frac{\mathrm{\partial}^{#3}#1}{\mathrm{\partial}{#2}^{#3}}} \newcommand{\partDerivLong}[3]{\frac{\mathrm{\partial}^{#3}}{\mathrm{\partial}{#2}^{#3}}#1} \newcommand{\partDerivIIHetero}[3]{\frac{\mathrm{\partial}^2#1}{\partial#2\mathrm{\partial}#3}} \newcommand{\partDerivIIHeteroLong}[3]{{\frac{\mathrm{\partial}^2}{\partial#2\mathrm{\partial}#3}#1}} % integral \newcommand{\pv}{{\textrm{ p.v. }}} \newcommand{\integrate}[5]{\int_{#1}^{#2}{#3}{\;\mathrm{d}^{#4}}#5} \newcommand{\LebInteg}[4]{\int_{#1} {#2} {#3}\parens*{\;\mathrm{d}#4}} % complex analysis \newcommand{\conj}[1]{\overline{#1}} \renewcommand{\Re}{\operatorname{Re}} \renewcommand{\Im}{\operatorname{Im}} \newcommand{\Arg}{\operatorname{Arg}} \newcommand{\Log}{\operatorname{Log}} % Laplace transform \newcommand{\LPLC}{\operatorname{\mathcal{L}}} \newcommand{\ILPLC}{\operatorname{\mathcal{L}}^{-1}} % discrete fourier transform \newcommand{\DFT}{\operatorname{DFT}} \newcommand{\IDFT}{\operatorname{IDFT}} % Z-transform \newcommand{\ZTrans}{\operatorname{\mathcal{Z}}} \newcommand{\IZTrans}{\operatorname{\mathcal{Z}}^{-1}} \newcommand{\SSZTrans}{\underset{\text{s.s.}}{\mathcal{Z}}} % single-sided Z-transform % linear algebra \newcommand{\bm}[1]{{\boldsymbol{#1}}} \newcommand{\vecEntry}[2]{\bm{#1}\bracks*{#2}} \newcommand{\matEntry}[3]{#1\bracks*{#2}\bracks*{#3}} \newcommand{\matPart}[5]{\matEntry{#1}{#2:#3}{#4:#5}} \newcommand{\minor}[3]{{#1}\bracks*{\setminus #2}\bracks*{\setminus #3}} % the minor of a matrix: row #2 and column #3 deleted \newcommand{\diag}{\operatorname{diag}} \newcommand{\transpose}[1]{{#1}^\top} \newcommand{\HerConj}[1]{{#1}^*} \newcommand{\tr}{\operatorname{tr}} \newcommand{\inProd}[2]{\left\langle#1,#2\right\rangle} \newcommand{\dotProd}[2]{#1 \cdot #2} \newcommand{\HadamardProd}{\odot} \newcommand{\HadamardDiv}{\oslash} \newcommand{\vecSpan}{\operatorname{span}} \newcommand{\rank}{\operatorname{rank}} % vector % unit vector \newcommand{\vix}{\bm{i}_x} \newcommand{\viy}{\bm{i}_y} \newcommand{\viz}{\bm{i}_z} % graph theory \newcommand{\neighborhood}{\mathcal{N}} % probability theory \newcommand{\PDF}{\operatorname{PDF}} \newcommand{\Ber}{\operatorname{Ber}} \newcommand{\Beta}{\operatorname{Beta}} \newcommand{\ExpDist}{\operatorname{ExpDist}} \newcommand{\ErlangDist}{\operatorname{ErlangDist}} \newcommand{\PoissonDist}{\operatorname{PoissonDist}} \newcommand{\GammaDist}{\operatorname{Gamma}} \newcommand{\cind}[2]{\ind{#1\left| #2\right.}} % conditional indicator function \renewcommand{\Pr}{\operatorname{Pr}} \DeclarePairedDelimiterX{\cPrParens}[2]{(}{)}{#1\,\delimsize\vert\,#2} \newcommand{\Ev}{\operatorname{E}} % expected value \newcommand{\Var}{\operatorname{Var}} \newcommand{\Cov}{\operatorname{Cov}} % physics % unit of measurement \newcommand{\second}{\text{s}} \newcommand{\hertz}{\text{Hz}} \newcommand{\decibel}{\text{dB}} % signal processing % Discrete Time Fourier Transform \newcommand{\DTFT}{\operatorname{DTFT}} \newcommand{\IDTFT}{\operatorname{IDTFT}} % computer science % fixed-point arithmetic \newcommand{\IntPartBW}[1]{\underbracket[0.140ex]{#1}_\mathrm{i}} % 0.140ex is half of the default thickness. See: [How to make underbracket thinner](https://tex.stackexchange.com/questions/559078/how-to-make-underbracket-thinner) \newcommand{\DecPartBW}[1]{\underbracket[0.140ex]{#1}_\mathrm{d}} \newcommand{\TotalBW}[1]{\underbracket[0.140ex]{#1}} \newcommand{\Rat}{\operatorname{Rat}} % Maps a fixed-point number to a corresponding rational number. % programming \newcommand{\plpl}{\mathrel{++}} \newcommand{\pleq}{\mathrel{+}=} \newcommand{\asteq}{\mathrel{*}=} \]
\[ \newcommand{\Tsamp}{T_\text{s}} \newcommand{\xd}{x_\text{d}} \newcommand{\Xd}{X_\text{d}} \newcommand{\xdd}{x_\text{dd}} \]

導出

$f_0>0$とし、連続時間の複素正弦波信号$u:t\in\realNumbers\mapsto\exp(i 2\pi f_0 t)$を考える。これを時刻$0$から$t\geq 0$まで積分した信号は$v(t) = \bigl(\exp(i 2\pi f_0 t)-1\bigr) / (i 2\pi f_0)$である。「0次ホールド機構の周波数特性」と同様に、矩形窓を通した、周波数表示された$v$のFourier変換を考える(窓の幅をサンプリング周期の整数倍に限っても影響が少ないことの説明は「0次ホールド機構の周波数特性」で述べられている)。$N\in\naturalNumbers$とし、窓の幅を$T=N\Tsamp$とする。$v$の窓付きFourier変換を窓の幅で規格化したものは次式である。但し計算は容易なので過程は省略した。

\[ \begin{align*} &\phantom{=} V(f) = \frac{1}{T} \integrate{0}{T}{v(t)\exp(-i 2\pi f t)}{}{t} \\ &= \frac{1}{i 2\pi f_0 T} \left\{\frac{1}{i 2\pi (f-f_0)}\bigl[1 – \exp\bigl(-i 2\pi (f-f_0)T\bigr)\bigr] + \frac{1}{i 2\pi f}\bigl(\exp(-i 2\pi f T) – 1\bigr)\right\} \end{align*} \]

次に、$u$の積分をサンプリング周期$\Tsamp>0$のEuler法で近似したものを考える。Euler法で積分した結果の離散時間信号を$\xdd:\integers\to\complexNumbers$とすると、これは漸化式$\xdd(n) = \xdd(n-1) + \Tsamp u\bigl((n-1)\Tsamp\bigr)$に従う。但し初期条件として$\xdd(0)=0$とする。この漸化式を解き、次式を得る。

\[ \xdd(n) = \Tsamp\frac{1-\exp(i 2\pi f_0 n\Tsamp)}{1-\exp(i 2\pi f_0\Tsamp)} \]

これを0次ホールドして得られる連続時間信号を$\xd(t) \coloneqq \xdd(\floor{t/\Tsamp}\Tsamp)$とする。先ほど$v$に対して行ったのと同様に窓付きFourier変換$\Xd$を計算すると、次式を得る。但し計算は容易なので過程の多くを省略した。

\[ \begin{align*} &\phantom{=} \Xd(f) = \frac{1}{T} \integrate{0}{T}{\xd(t)\exp(-i 2\pi f t)}{}{t} = \sum_{k=0}^{N-1} \frac{1}{T} \integrate{k\Tsamp}{(k+1)\Tsamp}{\xd(t)\exp(-i 2\pi f t)}{}{t} \\ &= \frac{1}{i 2\pi f N}\times\frac{1-\exp(-i 2\pi f\Tsamp)}{1-\exp(i 2\pi f_0\Tsamp)} \left\{\frac{1-\exp(-i 2\pi f \Tsamp N)}{1-\exp(-i 2\pi f \Tsamp)} – \frac{1-\exp(-i 2\pi (f-f_0) \Tsamp N)}{1-\exp(-i 2\pi (f-f_0) \Tsamp)}\right\} \end{align*} \]

$v$中の、周波数が$f_0$である成分の振幅と位相を調べる。$f\to f_0$の極限に関して次式が成り立つ。

\[ \lim_{f\to f_0} V(f) = \frac{1}{i2\pi f_0}\left[1 + \frac{\exp(-i 2\pi f_0 T)-1}{i 2\pi f_0 T}\right] \]

次に$\xd$中の、周波数が$f_0$である成分の振幅と位相を調べる。但し、$f_0\Tsamp < 1$と仮定する。次式が成り立つ。

\[ \lim_{f\to f_0} \Xd(f) = \frac{1}{i 2\pi f_0 N}\times\frac{1-\exp(-i 2\pi f_0\Tsamp)}{1-\exp(i 2\pi f_0\Tsamp)}\left\{\frac{1-\exp(-i 2\pi f_0 \Tsamp N)}{1-\exp(-i 2\pi f_0 \Tsamp)} – N\right\} \]

サンプリング周波数が十分高い、すなわち$f_0\Tsamp\ll 1$であるとき、次の近似式が成り立つ。

\[ \begin{align*} \lim_{f\to f_0} \Xd(f) &\approx \frac{1}{i 2\pi f_0 N}\times(-1)\left[\frac{1-\exp(-i 2\pi f_0 \Tsamp N)}{i 2\pi f_0 \Tsamp} – N\right] \\ &= \frac{1}{i 2\pi f_0}\left[1 + \frac{\exp(-i 2\pi f_0 \Tsamp N)-1}{i 2\pi f_0 \Tsamp N}\right] = \frac{1}{i 2\pi f_0}\left[1 + \frac{\exp(-i 2\pi f_0 T)-1}{i 2\pi f_0 T}\right] \\ &= \lim_{f\to f_0} V(f) \end{align*} \]

数値例

今、$f_0=10,\;\Tsamp=10^{-2},\;N=200$とする。$f=f_0$に於ける$v$の振幅と位相の組は$(1/(20\pi),\;-\pi/2) \approx(1.59\times10^{-2},-1.57)$である。一方、$\xd$の振幅と位相の組はおよそ$(1.59\times10^{-2},-2.20)$である。

次の図は$f_0$近傍でのエネルギー・スペクトラム密度$V,\Xd$を示したものである。

元の周波数近傍のエネルギー・スペクトラム密度

低周波領域では絶対値が良く一致していることがわかる。

次に高調波を見る。次の図はサンプリング周波数の3倍の範囲まで$V,\Xd$を示したものである。

高調波を含むエネルギー・スペクトラム密度

低周波の領域では$V,\Xd$が重なって判別できない。また、サンプリング周波数の整数倍の位置に高調波が生じていることが判る。

以上の数値例を計算したMathematicaノートブックをここで公開している。

コメントを残す