関数fft2_pow5_analytical マニュアル

(The documentation of function fft2_pow5_analytical)

Last Update: 2024/4/24


◆機能・用途(Purpose)

時間関数pow5 のフーリエスペクトルを解析式を用いて計算する。
Compute the Fourier spectrum of a time function pow5 using an analytical formula.

時間関数pow5はτpを正の定数として (1)f(t)={0(t<0)10(tτp)315(tτp)4+6(tτp)5(0tτp)1(τp<t) で定義され、そのフーリエスペクトルは F(ω)f(t)eiωtdt(2)=60τp(iωτp)4(1eiωτp)+360τp(iωτp)5(1+eiωτp)+720τp(iωτp)6(1eiωτp) となる ( 関数pow5のマニュアル参照)。 但しこれはフーリエ変換の定義にeiωtを用いた場合の式であり、 関数fft2に合わせてe+iωtを用いる場合には (2)式のωωで置き換えて F+(ω)f(t)e+iωtdt(3)=60τp(iωτp)4(1eiωτp)+360τp(iωτp)5(1+eiωτp)+720τp(iωτp)6(1eiωτp) となる。この関数では(3)式を用いて フーリエスペクトルを計算する。
A time function pow5 is defined by Eq. (1), where τp is a positive constant. The Fourier spectrum of it is given as Eq. (2) (see the documentation of function create_timefunc_pow5) if eiωt is used for the definition of the spectrum. If e+iωt is used instead (to be consistent with function fft2), the formula for the corresponding Fourier spectrum is obtained by replacing ω in Eq. (2) with ω, and the result is Eq. (3). This equation (3) is used in this function to compute the Fourier spectrum.

但し、(3)式の分母にωが登場するので ω=0の成分(DC成分)は計算できない。 そこでDC成分については 関数fft2 と等価な計算式を用いて数値的に計算する。関数fft2で用いている計算式は (4)FnF(nΔf)=e2πint02NΔtΔtk=02N1fke2πink2N である (Δf:周波数刻み、 Δt:時間刻み、 t0:時系列データの先頭時刻、 2N:時系列データのサンプル数、 fk:k番目のサンプル時刻における時系列データの値)。 ω=0の成分は(4)式でn=0として (5)F0=Δtk=02N1fk と計算できる。
However, the Fourier spectrum at ω=0 (the DC component) cannot be computed analytically because of ω in the denominator of Eq. (3). Therefore, the DC component is computed numerically using an equation equivalent to that used in function fft2 that is Eq. (4), where Δf is a frequency step, Δt is a time step, t0 is the beginning time of the input time series data, 2N is the number of samples of the time series data, and fk is the value of the time series data at kth time sample. The component for ω=0 can be computed by letting n=0 in Eq. (4) and the result is Eq. (5).


◆形式(Format)

#include <sequence/fft.h>
inline struct imsequence2 fft2_pow5_analytical
(const struct sequence timefunc,const double tp)


◆引数(Arguments)

timefunc フーリエ変換したい時間関数。 関数create_timefunc を用いて作成したpow5関数でなければならない。
A time function to convert to the Fourier spectrum. It must be a pow5 function created by function create_timefunc.
tp 時間関数のτpの値。 引数timefuncで与える時間関数に用いたものと同じでなければならない。
The value of τp of the time function, which must be same as that used for argument timefunc.


◆戻り値(Return value)

引数timefuncで与えた時間関数のフーリエスペクトル。 (3)(5)式を用いて計算される。 ナイキスト周波数から高周波側は 関数fill_spectrum2_upper_half を用いて計算される。
The Fourier spectrum of the time function given by argument timefunc, computed by Eqs. (3) and (5). The spectral components above the Nyquist frequency are computed by function fill_spectrum2_upper_half.


◆使用例(Example)

struct sequence timefunc=create_timefunc ("pow5",10.0,0.0,100000,0.0,0.01,0);
struct imsequence2 spectrum=fft2_pow5_analytical (timefunc,10.0);

赤字で示した2つのτpが共通でなければならない。
The two τp shown by red must be equal.


◆検証(Validation)

数値積分で得られるフーリエスペクトルとの比較により検証した。 この検証には0.01秒刻み、長さ1000秒、時定数τp=10 sのpow5関数を用いた。 そのフーリエスペクトルをこの関数(解析式)を用いて計算した場合と 関数fft2_sequence (数値積分)を用いて計算した場合とで同じ結果が得られるかをチェックした。
The output of this function was examined by comparison with a Fourier spectrum obtained by numerical integration. This examination used a pow5 function of 1000 s long with a time constant τp=10 s sampled at every 0.01 s. Its Fourier spectra computed by this function (based on an analytical equation) and by 関数fft2_sequence (numerical integral) were compared to check the results.

数値積分においてはpow5関数そのものを用いると正しい結果が得られない。 これはpow5関数がtで0に収束しないことによる。 すなわちpow5関数のフーリエ変換は (6)F(ω)=0τp[10(tτp)315(tτp)4+6(tτp)5]eiωtdt+τpeiωtdt となり、この第2項の積分を有限の時刻で打ち切ることによって無視できない誤差が生じる。 そこでpow5関数の導関数のフーリエ変換 (7)Fd(ω)=0τp[30(tτp)260(tτp)3+30(tτp)4τp]eiωtdt を数値的に計算し、次いでF(ω)=Fd(ω)/(iω)の関係を用いて F(ω)を計算する。実際の手順は
  1. 関数create_timefuncを用いてpow5関数の導関数を作成する
  2. そのフーリエスペクトルを関数fft2_sequenceを用いて計算する
  3. 得られたフーリエスペクトルの各周波数成分をiωで割る
という3ステップである。
The numerical integral of a pow5 function does not yield a correct Fourier spectrum. This is because the pow5 function does not converge to zero for t: the Fourier transformation of the pow5 function is given by Eq. (6), and truncating the integral of the 2nd term of this equation at a finite time results in a significant error. To avoid this problem, the Fourier transformation of the derivative of a pow5 function (F_d(\omega); Eq. 7) was computed, and then a relation F(ω)=Fd(ω)/(iω) was applied to obtain the Fourier spectrum F(ω). This procedure is composed of the following three steps:
  1. create the derivative of a pow5 function using function create_timefunc;
  2. compute its Fourier spectrum using function fft2_sequence; and
  3. divide each spectral component of the result by iω.

一方、解析式に基づくフーリエスペクトルは
  1. 関数create_timefuncを用いてpow5関数を作成する
  2. そのフーリエスペクトルを関数fft2_pow5_analyticalを用いて計算する
という2ステップで得られる。
The Fourier spectrum based on an analytical equation is computed by the following two steps:
  1. create a pow5 function using function create_timefunc; and
  2. compute its Fourier spectrum using function fft2_pow5_analytical.

下図はこのようにして計算したフーリエスペクトルを示している。 青緑が数値積分(関数fft2_sequence使用)、 赤線が解析式(関数fft2_pow5_analytical使用)である。 両者がよく一致していることからこの関数が正しい結果を与えることが分かる。
The figure below shows the Fourier spectra computed by these two different approaches; the blue-green line is the result of a numerical integration calculated with a function fft2_sequence, and the red line shows an analytical result calculated with a function fft2_pow5_analytical. The excellent fit between the two lines indicates the validity of this function.