関数create_timefunc_pow5 マニュアル

(The documentation of function create_timefunc_pow5)

Last Update: 2024/4/24


◆機能・用途(Purpose)

時間関数pow5(下記(\ref{eq.definition})式)に基づく時系列データを作成する。 エラーチェック機能が不十分なのでこの関数を直接用いてはならない。 この関数は関数create_timefuncからの内部呼び出し用である。
Create a time series data based on a time function pow5 defined by eq. (\ref{eq.definition}). Do not directly call this function because error checks are insufficient. This function is for an internal call from function create_timefunc.


◆時間関数の定義 (Definition of the time function)

概要(Overview)
時刻\(t<0\)で0、\(t>\tau_p\)で1、 かつ全ての時刻で2階導関数までが連続となる 最小次数の多項式である。 2階導関数までを連続とする目的については 関数pow3-4の説明参照。
The polynominal with minimum possible degrees that satisfies the following conditions: zero for \(t<0\), unity for \(t>\tau_p\), and second order derivative of the function is continuous at all the time. For the reason of requiring the second order derivative to be continuous, see the description of function pow3-4.


定義(Definition)
\[\begin{equation} f(t)= \begin{cases} 0 & (t<0) \\ 10\left(\frac{t}{\tau_p}\right)^3 -15\left(\frac{t}{\tau_p}\right)^4 +6\left(\frac{t}{\tau_p}\right)^5 & (0\leq t \leq \tau_p) \\ 1 & (\tau_p<t) \end{cases} \label{eq.definition} \end{equation}\]

1階導関数 (1st order derivative)
\[\begin{equation} \frac{df(t)}{dt}= \begin{cases} 0 & (t<0) \\ \frac{30\left(\frac{t}{\tau_p}\right)^2 -60\left(\frac{t}{\tau_p}\right)^3 +30\left(\frac{t}{\tau_p}\right)^4}{\tau_p} & (0\leq t \leq \tau_p) \\ 0 & (\tau_p<t) \end{cases} \label{eq.derivative} \end{equation}\]

1階積分 (1st order integral)
\[\begin{equation} F_1(t)=\int_{-\infty}^t f(t’)dt’= \begin{cases} 0 & (t<0) \\ \tau_p\left[\frac{5}{2}\left(\frac{t}{\tau_p}\right)^4 -3\left(\frac{t}{\tau_p}\right)^5 +\left(\frac{t}{\tau_p}\right)^6\right] & (0\leq t \leq \tau_p) \\ -\frac{\tau_p}{2}+t & (\tau_p<t) \end{cases} \label{eq.integral1} \end{equation}\]
ここで積分定数は\(t<0\)で\(F_1(t)=0\)、 \(t=0\)および\(t=\tau_p\)で\(F_1(t)\)が連続となるように与えた。
Here, the integration constants are taken so that \(F_1(t)\) is zero for \(t<0\) and continuous at \(t=0\) and \(t=\tau_p\).


2階積分 (2nd order integral)
\[\begin{equation} F_2(t)=\int_{-\infty}^t F_1(t’)dt’= \begin{cases} 0 & (t<0) \\ \tau_p^2\left[\frac{1}{2}\left(\frac{t}{\tau_p}\right)^5 -\frac{1}{2}\left(\frac{t}{\tau_p}\right)^6 +\frac{1}{7}\left(\frac{t}{\tau_p}\right)^7\right] & (0\leq t \leq \tau_p) \\ \frac{\tau_p^2}{7}-\frac{\tau_p}{2}t+\frac{1}{2}t^2 & (\tau_p<t) \end{cases} \label{eq.integral2} \end{equation}\]
ここで積分定数は\(t<0\)で\(F_2(t)=0\)、 \(t=0\)および\(t=\tau_p\)で\(F_2(t)\)が連続となるように与えた。
Here, the integration constants are taken so that \(F_2(t)\) is zero for \(t<0\) and continuous at \(t=0\) and \(t=\tau_p\).


フーリエスペクトル (Fourier spectrum)
pow5関数は\(t\rightarrow\infty\)で\(f(t)\rightarrow 0\)とならないので 取り扱いが厄介である。 そこでまずpow5関数の導関数\(df(t)/dt\)のフーリエスペクトル \[\begin{equation} F_d(\omega)\equiv \int_{-\infty}^{\infty} \frac{df(t)}{dt}e^{-i\omega t}dt \label{eq.Fd.def} \end{equation}\] を求める。(\ref{eq.derivative})を(\ref{eq.Fd.def})に代入すると \[\begin{equation} F_d(\omega)=\int_0^{\tau_p} \frac{30\left(\frac{t}{\tau_p}\right)^2 -60\left(\frac{t}{\tau_p}\right)^3 +30\left(\frac{t}{\tau_p}\right)^4}{\tau_p} e^{-i\omega t}dt \label{eq.Fd.expression} \end{equation}\] となる。\(t’\equiv t/\tau_p\)と変数変換した上で部分積分を繰り返すと \[\begin{eqnarray} F_d(\omega) &=& \int_0^1 \frac{30 t’^2-60t’^3+30t’^4}{\tau_p} e^{-i\omega\tau_p t’} \tau_p dt’ \nonumber \\ &=& \int_0^1 (30 t’^2-60t’^3+30t’^4) e^{-i\omega\tau_p t’}dt’ \nonumber \\ &=& \left[ (30 t’^2-60t’^3+30t’^4) \frac{1}{-i\omega\tau_p}e^{-i\omega\tau_p t’} \right]_0^1 \nonumber \\ & & -\int_0^1 (60t’-180t’^2+120t’^3) \frac{1}{-i\omega\tau_p}e^{-i\omega\tau_p t’}dt’ \nonumber \\ &=& \left[ (30 t’^2-60t’^3+30t’^4) \frac{1}{-i\omega\tau_p}e^{-i\omega\tau_p t’} \right]_0^1 \nonumber \\ & & -\left[ (60t’-180t’^2+120t’^3) \frac{1}{(-i\omega\tau_p)^2}e^{-i\omega\tau_p t’} \right]_0^1 \nonumber \\ & & +\int_0^1 (60-360t’+360t’^2) \frac{1}{(-i\omega\tau_p)^2}e^{-i\omega\tau_p t’}dt’ \nonumber \\ &=& \left[ (30 t’^2-60t’^3+30t’^4) \frac{1}{-i\omega\tau_p}e^{-i\omega\tau_p t’} \right]_0^1 \nonumber \\ & & -\left[ (60t’-180t’^2+120t’^3) \frac{1}{(-i\omega\tau_p)^2}e^{-i\omega\tau_p t’} \right]_0^1 \nonumber \\ & & +\left[ (60-360t’+360t’^2) \frac{1}{(-i\omega\tau_p)^3}e^{-i\omega\tau_p t’} \right]_0^1 \nonumber \\ & & -\int_0^1 (-360+720t’) \frac{1}{(-i\omega\tau_p)^3}e^{-i\omega\tau_p t’}dt’ \nonumber \\ &=& \left[ (30 t’^2-60t’^3+30t’^4) \frac{1}{-i\omega\tau_p}e^{-i\omega\tau_p t’} \right]_0^1 \nonumber \\ & & -\left[ (60t’-180t’^2+120t’^3) \frac{1}{(-i\omega\tau_p)^2}e^{-i\omega\tau_p t’} \right]_0^1 \nonumber \\ & & +\left[ (60-360t’+360t’^2) \frac{1}{(-i\omega\tau_p)^3}e^{-i\omega\tau_p t’} \right]_0^1 \nonumber \\ & & -\left[ (-360+720t’) \frac{1}{(-i\omega\tau_p)^4}e^{-i\omega\tau_p t’} \right]_0^1 \nonumber \\ & & +\int_0^1 720 \frac{1}{(-i\omega\tau_p)^4}e^{-i\omega\tau_p t’}dt’ \nonumber \\ &=& \left[ (30 t’^2-60t’^3+30t’^4) \frac{1}{-i\omega\tau_p}e^{-i\omega\tau_p t’} \right]_0^1 \nonumber \\ & & -\left[ (60t’-180t’^2+120t’^3) \frac{1}{(-i\omega\tau_p)^2}e^{-i\omega\tau_p t’} \right]_0^1 \nonumber \\ & & +\left[ (60-360t’+360t’^2) \frac{1}{(-i\omega\tau_p)^3}e^{-i\omega\tau_p t’} \right]_0^1 \nonumber \\ & & -\left[ (-360+720t’) \frac{1}{(-i\omega\tau_p)^4}e^{-i\omega\tau_p t’} \right]_0^1 \nonumber \\ & & +\left[ 720\frac{1}{(-i\omega\tau_p)^5}e^{-i\omega\tau_p t’} \right]_0^1 \nonumber \\ &=& \left[ 60\frac{1}{(-i\omega\tau_p)^3}e^{-i\omega\tau_p} -60\frac{1}{(-i\omega\tau_p)^3} \right] \\ & & -\left[ 360\frac{1}{(-i\omega\tau_p)^4}e^{-i\omega\tau_p} +360\frac{1}{(-i\omega\tau_p)^4} \right] \nonumber \\ & & +\left[ 720\frac{1}{(-i\omega\tau_p)^5}e^{-i\omega\tau_p} -720\frac{1}{(-i\omega\tau_p)^5} \right] \nonumber \\ &=& -\frac{60}{(-i\omega\tau_p)^3}\left(1-e^{-i\omega\tau_p}\right) \nonumber \\ & & -\frac{360}{(-i\omega\tau_p)^4}\left(1+e^{-i\omega\tau_p}\right) \nonumber \\ & & -\frac{720}{(-i\omega\tau_p)^5}\left(1-e^{-i\omega\tau_p}\right) \label{eq.Fd.final} \end{eqnarray}\] を得る。したがってpow5関数のフーリエスペクトルは \[\begin{eqnarray} F(\omega) &\equiv& \int_{-\infty}^{\infty}f(t)e^{-i\omega t}dt \nonumber \\ &=& \frac{F_d(\omega)}{i\omega} \nonumber \\ &=& -\frac{60}{i\omega(-i\omega\tau_p)^3}\left(1-e^{-i\omega\tau_p}\right) -\frac{360}{i\omega(-i\omega\tau_p)^4}\left(1+e^{-i\omega\tau_p}\right) \nonumber \\ & & -\frac{720}{i\omega(-i\omega\tau_p)^5}\left(1-e^{-i\omega\tau_p}\right) \nonumber \\ &=& \frac{60\tau_p}{(-i\omega\tau_p)^4}\left(1-e^{-i\omega\tau_p}\right) +\frac{360\tau_p}{(-i\omega\tau_p)^5}\left(1+e^{-i\omega\tau_p}\right) \nonumber \\ & & +\frac{720\tau_p}{(-i\omega\tau_p)^6}\left(1-e^{-i\omega\tau_p}\right) \label{eq.spectrum} \end{eqnarray}\] と計算できる。
The treatment of the pow5 function is not straightforward because it does not converge to zero at \(t\rightarrow\infty\). Therefore, let us first derive a Fourier spectrum for the derivative of the pow5 function \(df(t)/dt\) (Eq. \ref{eq.Fd.def}) Inserting Eq. (\ref{eq.derivative}) into (\ref{eq.Fd.def}) results in (\ref{eq.Fd.expression}). Using \(t’\equiv t/\tau_p\) and repeating partial integrals, we obtain Eq. (\ref{eq.Fd.final}). From this, the Fourier spectrum of the pow5 function is calculated as Eq. (\ref{eq.spectrum}).


関数形の導出過程 (Derivation of the function form)
\[\begin{equation} f(t)= \begin{cases} 0 & (t<0) \\ f_0(t) & (0\leq t \leq \tau_p) \\ 1 & (\tau_p<t) \end{cases} \label{eq.derive.rampform} \end{equation}\] の形の関数\(f(t)\)を考える。 \(t=0\)において\(f(t)\)の2階導関数までが連続であるための条件は \[\begin{equation} f_0(0)=0, \hspace{1em} \frac{df_0}{dt}(0)=0, \hspace{1em} \frac{d^2f_0}{dt^2}(0)=0 \label{eq.derive.continuous.st} \end{equation}\] と書ける。一方、\(t=\tau_p\)において\(f(t)\)の2階導関数までが連続であるための条件は \[\begin{equation} f_0(\tau_p)=1, \hspace{1em} \frac{df_0}{dt}(\tau_p)=0, \hspace{1em} \frac{d^2 f_0}{dt^2}(\tau_p)=0 \label{eq.derive.continuous.en} \end{equation}\] と書き下せる。 以上の条件だけでは\(f_0(t)\)は一意には決まらないが、 最も次数の低い多項式という条件から未定係数を6つ持つ多項式、すなわち5次多項式 \[\begin{equation} f_0(t) = a_0 + a_1t^1 + a_2t^2 + a_3t^3 + a_4t^4 + a_5t^5 \label{eq.derive.polynominal} \end{equation}\] を考えれば良い。 (\ref{eq.derive.polynominal})を (\ref{eq.derive.continuous.st})に代入すると\(a_0=a_1=a_2=0\)が得られ、 これらの結果と(\ref{eq.derive.polynominal})を (\ref{eq.derive.continuous.en})に代入すると \(a_3,a_4,a_5\)に関する連立方程式 \[\begin{equation} f_0(\tau_p)=a_3\tau_p^3+a_4\tau_p^4+a_5\tau_p^5=1 \label{eq.derive.continuous.en.0} \end{equation}\] \[\begin{equation} \frac{df_0}{dt}(\tau_p)=3a_3\tau_p^2+4a_4\tau_p^3+5a_5\tau_p^4=0 \label{eq.derive.continuous.en.1} \end{equation}\] \[\begin{equation} \frac{d^2 f_0}{dt^2}(\tau_p)=6a_3\tau_p+12a_4\tau_p^2+20a_5\tau_p^3=0 \label{eq.derive.continuous.en.2} \end{equation}\] が得られる。これらは行列形式で \[\begin{equation} \begin{pmatrix} \tau_p^3 & \tau_p^4 & \tau_p^5 \\ 3\tau_p^2 & 4\tau_p^3 & 5\tau_p^4 \\ 6\tau_p & 12\tau_p^2 & 20\tau_p^3 \end{pmatrix} \begin{pmatrix} a_3 \\ a_4 \\ a_5 \end{pmatrix} = \begin{pmatrix} 1 \\ 0 \\ 0 \end{pmatrix} \label{eq.derive.continous.en.matrix} \end{equation}\] と書くことができ、その解はクラメルの公式から \[\begin{equation} a_3 =\frac{\begin{vmatrix} 1 & \tau_p^4 & \tau_p^5 \\ 0 & 4\tau_p^3 & 5\tau_p^4 \\ 0 & 12\tau_p^2 & 20\tau_p^3 \end{vmatrix}} {\begin{vmatrix} \tau_p^3 & \tau_p^4 & \tau_p^5 \\ 3\tau_p^2 & 4\tau_p^3 & 5\tau_p^4 \\ 6\tau_p & 12\tau_p^2 & 20\tau_p^3 \end{vmatrix}} =\frac{20\tau_p^6}{2\tau_p^9} =\frac{10}{\tau_p^3} \label{eq.derive.a3} \end{equation}\] \[\begin{equation} a_4 =\frac{\begin{vmatrix} \tau_p^3 & 1 & \tau_p^5 \\ 3\tau_p^2 & 0 & 5\tau_p^4 \\ 6\tau_p & 0 & 20\tau_p^3 \end{vmatrix}} {\begin{vmatrix} \tau_p^3 & \tau_p^4 & \tau_p^5 \\ 3\tau_p^2 & 4\tau_p^3 & 5\tau_p^4 \\ 6\tau_p & 12\tau_p^2 & 20\tau_p^3 \end{vmatrix}} =\frac{-30\tau_p^5}{2\tau_p^9} =-\frac{15}{\tau_p^4} \label{eq.derive.a4} \end{equation}\] \[\begin{equation} a_5 =\frac{\begin{vmatrix} \tau_p^3 & \tau_p^4 & 1 \\ 3\tau_p^2 & 4\tau_p^3 & 0 \\ 6\tau_p & 12\tau_p^2 & 0 \end{vmatrix}} {\begin{vmatrix} \tau_p^3 & \tau_p^4 & \tau_p^5 \\ 3\tau_p^2 & 4\tau_p^3 & 5\tau_p^4 \\ 6\tau_p & 12\tau_p^2 & 20\tau_p^3 \end{vmatrix}} =\frac{12\tau_p^4}{2\tau_p^9} =\frac{6}{\tau_p^5} \label{eq.derive.a5} \end{equation}\] となる。これらの結果を(\ref{eq.derive.polynominal})に代入すれば (\ref{eq.definition})が得られる。
Consider a function \(f(t)\) that satisfies eq. (\ref{eq.derive.rampform}). The requirements that the second derivatives of \(f(t)\) are continuous at \(t=0\) and \(t=\tau_p\) are expressed as (\ref{eq.derive.continuous.st}) and (\ref{eq.derive.continuous.en}), respectively. In addition to these requirements, the function \(f_0(t)\) must be a polynominal with minimum possible degrees. Therefore one has to consider a polynominal with six unknowns, or a polynominal with 5-th regrees, given by eq. (\ref{eq.derive.polynominal}). Inserting (\ref{eq.derive.polynominal}) into (\ref{eq.derive.continuous.st}) yields \(a_0=a_1=a_2=0\), and inserting these results and (\ref{eq.derive.polynominal}) into (\ref{eq.derive.continuous.en}) gives eqs. (\ref{eq.derive.continuous.en.0})- (\ref{eq.derive.continuous.en.2}), which can be written in a matrix form as (\ref{eq.derive.continous.en.matrix}). The solution of this equation can be calculated by Cramer's formula as (\ref{eq.derive.a3})-(\ref{eq.derive.a5}), and inserting these solutions into (\ref{eq.derive.polynominal}) results in eq. (\ref{eq.definition}).


◆形式(Format)

#include <sequence/timefunc.h>
inline struct sequence create_timefunc_pow5
(const double tp,const int size,const double t0,const double dt,
 const int Nintegral)


◆引数(Arguments)

tp (\ref{eq.definition})式における\(\tau_p\)の値。
The value of \(\tau_p\) in eq. (\ref{eq.definition}).
size 作成する時系列データのサンプル数。
The number of samples of the time series data to create.
t0 作成する時系列データの先頭時刻。
The beginning time of the time series data to create.
dt 作成する時系列データのサンプリング間隔。
The sampling interval of the time series data to create.
Nintegral 積分回数。以下の4つの値のいずれかを指定する。
The number of integrals, which must be one of the followings.
\(-1\) 時間関数の微分形(\ref{eq.derivative}式)を作成する。
Create the differential form (eq. \ref{eq.derivative}) of the time function.
0 時間関数そのもの(\ref{eq.definition}式)を作成する。
Create the time function itself (eq. \ref{eq.definition}).
1 時間関数の1階積分形(\ref{eq.integral1}式)を作成する。
Create the 1st order integral form (eq. \ref{eq.integral1}) of the time function.
2 時間関数の2階積分形(\ref{eq.integral2}式)を作成する。
Create the 2nd order integral form (eq. \ref{eq.integral2}) of the time function.


◆戻り値(Return value)

引数Nintegralの値に応じて (\ref{eq.definition}) (\ref{eq.derivative}) (\ref{eq.integral1}) (\ref{eq.integral2})の いずれかの時間関数を表す時系列データ。
A time series data which represents the time function of either of eqs. (\ref{eq.definition}), (\ref{eq.derivative}), (\ref{eq.integral1}), and (\ref{eq.integral2}) depending on argument Nintegral.


◆使用例(Example)

struct sequence timefunc=create_timefunc_pow5(5.0,10001,-2.0,0.01,1);

この例では(\ref{eq.integral1})式で\(\tau_p=5\) sとした時系列データが \(t\in [-2,98]\)の時間範囲において0.01 sのサンプリング間隔で作成される。
In this example, a time series data based on eq. (\ref{eq.integral1}) with \(\tau_p=5\) s is created in a time range \(t\in [-2,98]\) with 0.01 s sampling intervals.