ARCS6 AR6-REV.24062600
読み取り中…
検索中…
一致する文字列を見つけられません
PulseWave.hh
1
6//
7// Copyright (C) 2011-2022 Yokokura, Yuki
8// This program is free software;
9// you can redistribute it and/or modify it under the terms of the FreeBSD License.
10// For details, see the License.txt file.
11
12#ifndef PULSEWAVE
13#define PULSEWAVE
14
15#include "Matrix.hh"
16
17namespace ARCS { // ARCS名前空間
18double PulseWave(const double freq, const double phase, const double time);
19double PulseWave(const double freq, const double phase, const double time, const double starttime);
20
27template <size_t M>
28void PulseWave(const double freq, const double phase, const double time, Matrix<1,M>& output){
29 double r = sin(2.0*M_PI*freq*time + phase);
30 if(0 < r){
31 output = Matrix<1,M>::ones();
32 }else{
33 output = Matrix<1,M>::zeros();
34 }
35}
36
43template <size_t M>
44Matrix<1,M> PulseWaveVec(const double freq, const double phase, const double time){
45 Matrix<1,M> ret;
46 PulseWave(freq, phase, time, ret);
47 return ret;
48}
49
50}
51
52#endif
行列/ベクトル計算クラス(テンプレート版)
constexpr void sin(const ArcsMat< M, N, T > &U, ArcsMat< P, Q, R > &Y)
行列要素の正弦関数を計算する関数(引数渡し版)
Definition ArcsMatrix.hh:4210
static constexpr Matrix ones(void)
m行n列の要素がすべて1の行列を返す関数
Definition Matrix.hh:655
static constexpr Matrix zeros(void)
m行n列の零行列を返す関数
Definition Matrix.hh:648