本文整理汇总了C++中Signal::resize方法的典型用法代码示例。如果您正苦于以下问题:C++ Signal::resize方法的具体用法?C++ Signal::resize怎么用?C++ Signal::resize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Signal
的用法示例。
在下文中一共展示了Signal::resize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: revert
void Downsampler::revert(Signal& signal) const
{
// Resize and set the sample rate on the signal
int revertedSize = _fineStructure.size();
signal.resize(revertedSize);
signal.sampleRate = _fineStructure.sampleRate;
// Move the values to their new positions and add the fine structure
double sizeRatio = signal.size() / revertedSize;
for(int i = revertedSize - 1; i >= 0; i--)
signal[i] = signal[sizeRatio * i] + _fineStructure[i];
}
示例2: inverse
TransformeeFourier::Signal TransformeeFourier::inverse(const Signal & signal){
Signal returnRecompoTransfoFourier;
double N = signal.size();
returnRecompoTransfoFourier.resize((int)(N));
for(double j = -N/2; j < N/2; j++){
returnRecompoTransfoFourier[(j+(N/2))] = 0;
for(double i = 0; i < N; i ++){
std::complex<double> c(0.0, ((j+(N/2)))*i*M_PI*2.0/N);
returnRecompoTransfoFourier[(j+(N/2))] += signal[i] * exp(c);
}
}
return returnRecompoTransfoFourier;
}
示例3: filter
Downsampler::Downsampler(Signal& signal, double targetRate):
_fineStructure(signal),
_newSampleRate(signal.sampleRate /
pow(2, (int)(log(signal.sampleRate / targetRate) / log(2))))
{
int oldSize = signal.size();
// Apply a lowpass filter to obtain the fine structure
LowpassFilter filter(_newSampleRate / 2);
filter.filter(signal);
for(int i = 0; i < oldSize; i++)
_fineStructure[i] -= signal[i];
// Fill values into new positions
int newSize = (int)(_newSampleRate / signal.sampleRate * oldSize);
double sizeRatio = oldSize / newSize;
for(int i = 0; i < newSize; i++)
signal[i] = signal[(int)(sizeRatio * i)];
// Set the new size and sample rate
signal.resize(std::min(newSize, oldSize));
signal.sampleRate = _newSampleRate;
}