-2
这是导致问题的部分。我真的无法找到任何不好的事情。这部分用于前端结构的梅尔装仓功能。我的C程序的浮点异常
的原始文件是在http://www.ee.columbia.edu/~stanchen/fall12/e6870/labs/lab1.html
感谢您的帮助提前!
double fmax = 0;
double w = 0; // half of the length of the bottom line of each bin of triangular
fmax = 1127*log(1+1/(1400*samplePeriod));
w = fmax/27;
double f = 0;
double fmel = 0;
double xf = 0;
double H = 0;
double sum = 0;
for (int frmIdx = 0; frmIdx < inFrameCnt; ++frmIdx)
for (int dimIdx = 0; dimIdx < outDimCnt; ++dimIdx){
sum = 0;
for (int j = 0; j < 256; ++j){
f = j/(256/20000);
fmel = 1127*log(1+f/700);
xf = sqrt(inFeats(frmIdx,2*j)*inFeats(frmIdx,2*j)+inFeats(frmIdx,2*j+1)*inFeats(frmIdx,2*j+1));
if (fmel > dimIdx*w && fmel < (dimIdx+1)*w){
H = (fmel- dimIdx*w)/w;
}
else if(fmel > ((dimIdx+1)*w) && fmel < ((dimIdx+2)*w)){
H = ((dimIdx+2)*w-fmel)/w;
}
else {
H = 0;
}
sum = sum + xf*H;
}
outFeats(frmIdx,dimIdx)=sum;
if (doLog == true){
outFeats(frmIdx,dimIdx) = log(outFeats(frmIdx,dimIdx));
}
else{
outFeats(frmIdx,dimIdx) = outFeats(frmIdx,dimIdx);
}
}
.........在哪里? – 2012-10-04 20:42:35
你在哪里指的是什么? – Yaozhong
@Yazohong我是指发生异常的地方? – 2012-10-04 20:45:17