public ZohNosdacCompensation(int length) { Taps = length; switch (length) { case 9: mCoeffs = new double[9]; Array.Copy(mCoeffs9, mCoeffs, mCoeffs9.Length); break; case 17: mCoeffs = new double[17]; Array.Copy(mCoeffs17, mCoeffs, mCoeffs17.Length); mCoeffs = mCoeffs17; break; case 33: mCoeffs = new double[33]; Array.Copy(mCoeffs33, mCoeffs, mCoeffs33.Length); /* フィルター係数が、DCゲインが1.0になるようにスケールする。 * */ for (int i = 0; i < mCoeffs.Length; ++i) { mCoeffs[i] *= 1.5405388308838; } break; default: throw new System.ArgumentException("length"); } mDelay = new WWUtil.Delay(length); mDelay.FillZeroes(); }
/// <summary> /// 偶関数のFIRフィルター。 /// </summary> /// <param name="parity">係数の数が奇数か偶数か。奇数の時フィルター係数の総数はhalfCoeffs*2-1。</param> /// <param name="halfCoeffs">フィルター係数の半分または半分+1個</param> public SymmetricalFIR(WWMath.WWParity parity, double[] halfCoeffs) { // halfCoeffs.Length=3のとき coeffのLength=5 // mDelayの蓄積サンプル数=5 mHalfCoeffs = halfCoeffs; mParity = parity; if (mParity == WWMath.WWParity.Odd) { mDelay = new WWUtil.Delay(mHalfCoeffs.Length * 2 - 1); } else { mDelay = new WWUtil.Delay(mHalfCoeffs.Length * 2); } mDelay.FillZeroes(); }