5 for(i=0; i<
n; ++
i)
if(v<x[i])
break;
8 return y[i-1] + (v-x[i-1])/(x[i] - x[i-1]) *(y[
i] - y[i-1]);
11 double interp(
double v,
double*
x,
double*
y,
int n,
double left,
double right)
13 for(i=0; i<
n; ++
i)
if(v<x[i])
break;
16 return y[i-1] + (v-x[i-1])/(x[i] - x[i-1]) *(y[
i] - y[i-1]);
19 double*
interp(
double*
v,
int Nv,
double*
x,
double*
y,
int n,
double left,
double right)
20 {
double* res =
new double[Nv];
21 for(
int i=0;
i<Nv; ++
i)res[
i] =
interp(v[
i], x, y, n, left, right);
34 {
return Complex(cos(phase), sin(phase));
38 {
return sqrt(x.
Re()*x.
Re() + x.
Im()*x.
Im());
Complex(double r=0., double i=0.)
cout<< endl;cout<< "ts size = "<< ts.size()<< " ts rate = "<< ts.rate()<< endl;tf.Forward(ts, wdm);int levels=tf.getLevel();cout<< "tf size = "<< tf.size()<< endl;double dF=tf.resolution();double dT=1./(2 *dF);cout<< "rate(hz) : "<< RATE<< "\t layers : "<< nLAYERS<< "\t dF(hz) : "<< dF<< "\t dT(ms) : "<< dT *1000.<< endl;int itime=TIME_PIXEL_INDEX;int ifreq=FREQ_PIXEL_INDEX;int index=(levels+1)*itime+ifreq;double time=itime *dT;double freq=(ifreq >0)?ifreq *dF:dF/4;cout<< endl;cout<< "PIXEL TIME = "<< time<< " sec "<< endl;cout<< "PIXEL FREQ = "<< freq<< " Hz "<< endl;cout<< endl;wavearray< double > x
Complex operator*(const Complex &x, const Complex &y)
Complex Exp(double phase)
Complex operator+(const Complex &x, const Complex &y)
double interp(double v, double *x, double *y, int n)
double fabs(const Complex &x)