TS++ library: time series library

◆ value()

double ts::tapers::FourPoint::value ( const int &  i) const
privatevirtual

returns taper value for sample index i. Private virtual function such that this function can only be accessed through the template function apply(). This way we ensure that the appropriate index range was set first.

Implements ts::tapers::Taper.

Definition at line 232 of file tapers.cc.

References Mfac1, Mfac2, Mti1, Mti2, Mti3, and Mti4.

233  {
234  //cout << i << " ";
235  double retval=0.;
236  double t=static_cast<double>(i);
237  if (t<Mti1)
238  {
239  //cout << "t<Mti1" << " ";
240  retval=0.;
241  }
242  else if (t<=Mti2)
243  {
244  //cout << "t<=Mti2" << " ";
245  retval=0.5*(1.-cos(Mfac1*(t-Mti1)));
246  }
247  else if (t<Mti3)
248  {
249  //cout << "t<Mti3" << " ";
250  retval=1.;
251  }
252  else if (t<=Mti4)
253  {
254  //cout << "t<=Mti4" << " ";
255  retval=0.5*(1.+cos(Mfac2*(t-Mti3)));
256  }
257  else
258  {
259  //cout << "else" << " ";
260  retval=0.;
261  }
262  //cout << "retval=" << retval << endl;
263  return (retval);
264  } // double FourPoint::value(const int& i) const
double Mti1
times in units of sampling interval relative to sample index zero
Definition: tapers.h:154