零点と極のペア。
IIR フィルタを想定。 2次のIIRフィルタ→零点と極が1ペアずつ。
Наследование: ICloneable
Пример #1
0
		/// <summary>
		/// フィルタの零点/極を計算。
		/// 結果格納用の配列を関数内で確保。
		/// </summary>
		/// <returns>フィルタの零点/極一覧</returns>
		public virtual ZeroPole[] GetZeroPole()
		{
			ZeroPole[] roots = new ZeroPole[this.Length];
			for(int i=0; i<roots.Length; ++i) roots[i] = new ZeroPole();

			this.GetZeroPole(roots);
			return roots;
		}
Пример #2
0
        /// <summary>
        /// フィルタの零点/極を計算。
        /// 結果格納用の配列を関数内で確保。
        /// </summary>
        /// <returns>フィルタの零点/極一覧</returns>
        public virtual ZeroPole[] GetZeroPole()
        {
            ZeroPole[] roots = new ZeroPole[this.Length];
            for (int i = 0; i < roots.Length; ++i)
            {
                roots[i] = new ZeroPole();
            }

            this.GetZeroPole(roots);
            return(roots);
        }
Пример #3
0
		/// <summary>
		/// フィルタの零点/極を計算。
		/// </summary>
		/// <param name="roots">零点/極一覧の格納先</param>
		public override void GetZeroPole(ZeroPole[] roots)
		{
			double m1 = this.m1;
			double m1p = 1 - this.m1;

			double Kk1  = Elliptic.K(m1);
			double Kk1p = Elliptic.K(m1p);

			double temp1 = -Math.PI * Kk1p / (this.order * Kk1);
			double temp2 = Math.Exp(temp1);

			double m    = Elliptic.InverseQ(Math.Exp(-Math.PI * Kk1p / (this.order * Kk1)));
			double mp   = 1 - m;
			double k    = Math.Sqrt(m);
			double Kk   = Elliptic.K(m);

			double Kkp  = Elliptic.K(mp);
			double temp3 = (Kk / Kkp) / (Kk1 / Kk1p);

			double phi, sn_p, cn_p, dn_p;
			double v = Elliptic.F(Math.Atan(1 / this.epsilon), m1p) * Kk / (this.order * Kk1);
			Elliptic.Jacobi(v, mp, out phi, out sn_p, out cn_p, out dn_p);

			for(int i=this.order-1, j=0; i>0; i-=2, ++j)
			{
				double sn, cn, dn;
				double u = Kk * (double)i / this.order;
				Elliptic.Jacobi(u, m, out phi, out sn, out cn, out dn);

				double denom = 1 - dn * dn * sn_p * sn_p;
				double re = -cn * dn * sn_p * cn_p / denom;
				double im = -sn * dn_p / denom;

				roots[j].zero = new Root(Root.Type.Complex, 0, 1 / (k * sn));
				roots[j].pole = new Root(Root.Type.Complex, re, im);
			}

			if((this.order & 1) == 1)
			{
				double denom = 1 - sn_p * sn_p;
				double re = -sn_p * cn_p / denom;

				roots[this.order / 2].zero = new Root(Root.Type.None, 0, 0);
				roots[this.order / 2].pole = new Root(Root.Type.Single, re, 0);
			}
		}
		/// <summary>
		/// フィルタの零点/極を計算。
		/// </summary>
		/// <param name="roots">零点/極一覧の格納先</param>
		public override void GetZeroPole(ZeroPole[] roots)
		{
			for(int i=this.order-1, j=0; i>0; i-=2, ++j)
			{
				double w = Math.PI / 2.0 * (double)i / this.order;
				double sin, cos;
				GetSinCos(w, out sin, out cos);

				roots[j].zero = new Root(Root.Type.None, 0, 0);
				roots[j].pole = new Root(Root.Type.Complex, -cos, -sin);
			}

			if((this.order & 1) == 1)
			{
				roots[this.order / 2].zero = new Root(Root.Type.None, 0, 0);
				roots[this.order / 2].pole = new Root(Root.Type.Single, -1, 0);
			}
		}
Пример #5
0
 public static void ZeroPoleToAnalogPrototype(ZeroPole zeropole, Coefficient coef)
 {
     RootToAnalogPrototype(zeropole.zero, coef.b);
     RootToAnalogPrototype(zeropole.pole, coef.a);
 }
Пример #6
0
		/// <summary>
		/// フィルタの零点/極を計算。
		/// </summary>
		/// <param name="roots">零点/極一覧の格納先</param>
		public abstract void GetZeroPole(ZeroPole[] roots);
Пример #7
0
		public static void ZeroPoleToAnalogPrototype(ZeroPole[] roots, Coefficient[] coefs)
		{
			for(int i=0; i<roots.Length; ++i)
			{
				ZeroPoleToAnalogPrototype(roots[i], coefs[i]);
			}
		}
Пример #8
0
		public static void ZeroPoleToAnalogPrototype(ZeroPole zeropole, Coefficient coef)
		{
			RootToAnalogPrototype(zeropole.zero, coef.b);
			RootToAnalogPrototype(zeropole.pole, coef.a);
		}