Package DSP.filter

Examples of DSP.filter.Polynomial


        prod *= ( (double)(D - N + n ) ) / ( (double) (D - N + i + n ) );
      }
      a[i] = Math.pow( -1, i ) * ( factorial(N) / ( factorial(N-i) * factorial(i) ) ) * prod;
    }
   
    Polynomial P = new Polynomial( a );
    k            = P.reflectionCoefficients();
    constructRationalRepresentation();
   
  }
View Full Code Here


      int nComplexPolePairs = order/2;
      int nPoles            = nRealPoles + 2*nComplexPolePairs;
     
      if ( nRealPoles == 1 ) {
        double[] td = { 1.0/a, 1.0};
        addSection( new Rational( new Polynomial(1.0), new Polynomial(td) ) );
      }
     
      double dAngle = Math.PI/nPoles;

      for ( int i = 0;  i < nComplexPolePairs;  i++ ) {
          double angle = -Math.PI/+  dAngle/2 *( 1 + nRealPoles +  i*dAngle;
          Complex pole = Complex.divide( 1.0, new Complex( a*Math.sin(angle), b*Math.cos(angle ) ) );
          double[] td    = { pole.real()*pole.real() + pole.imag()*pole.imag(), -2*pole.real(), 1.0 };
          double zeroimag = 1.0/Math.cos((2*i+1)*Math.PI/(2*order) );
          double[] tn     = { zeroimag*zeroimag, 0.0, 1.0 };
          addSection( new Rational( new Polynomial(tn), new Polynomial(td) ) );
      }
     
      // scale to 1 at s = 0
     
      double DCvalue = evaluate( 0.0 ).abs();
View Full Code Here

    int nComplexPolePairs = order/2;
    int nPoles            = nRealPoles + 2*nComplexPolePairs;
   
        if ( nRealPoles == 1 ) {
          double[] td = {1.0, 1.0};
          addSection( new Rational( new Polynomial(1.0), new Polynomial(td) ) );
        }
       
      double dAngle = Math.PI/nPoles;

      for ( int i = 0;  i < nComplexPolePairs;  i++ ) {
          double   angle = -Math.PI/+  dAngle/2 *( 1 + nRealPoles +  i*dAngle;
          double[] td    = {1.0, -2*Math.sin(angle), 1.0 };
          addSection( new Rational( new Polynomial(1.0), new Polynomial(td) ) );
      }
     
  }
View Full Code Here

    int nComplexPolePairs = order/2;
    int nPoles            = nRealPoles + 2*nComplexPolePairs;
   
    if ( nRealPoles == 1 ) {
      double[] td = { a, 1.0};
      addSection( new Rational( new Polynomial(1.0), new Polynomial(td) ) );
    }
   
    double dAngle = Math.PI/nPoles;

    for ( int i = 0;  i < nComplexPolePairs;  i++ ) {
        double   angle = -Math.PI/+  dAngle/2 *( 1 + nRealPoles +  i*dAngle;
        Complex pole = new Complex( a*Math.sin(angle), b*Math.cos(angle ) );
        double[] td    = { pole.real()*pole.real() + pole.imag()*pole.imag(), -2*pole.real(), 1.0 };
        addSection( new Rational( new Polynomial(1.0), new Polynomial(td) ) );
    }
   
    // scale to 1 at s = 0
   
    sections.get( 0 ).timesEquals( 1.0 / ( Math.pow(2.0, order-1)*epsilon ) );
View Full Code Here

    }
   
    Arrays.fill( b, 0.0 );
    for ( int i = 0;  i <= order;  i++ ) b[i] = a[ order - i ];
   
    T = new Rational( (new Polynomial(b)), (new Polynomial(a)) );
  }
View Full Code Here

         
          Polynomial[] DT = lptobpFactors( section.denominator(), BW, prod );
          double[] t1 = { 0.0, 1.0 };
         
          if ( order[0] == 0 ) {
            retval.addSection( new Rational( new Polynomial(t1), DT[0] ) );
            retval.addSection( new Rational( new Polynomial(t1), DT[1] ) );
          }
          else if ( order[0] == 1 ) {
            retval.addSection( new Rational( new Polynomial(t1), DT[0] ) );
            double[] t2 = new double[3];
            double[] tc = Tsection.numerator().coefficients();
            for ( int j = 0;  j < 3;  j++ ) t2[j] = tc[j+1];
            retval.addSection( new Rational( new Polynomial(t2), DT[1] ) );
          }
          else if ( order[0] == 2 ) {
            Polynomial[] NT = lptobpFactors( section.numerator(), BW, prod );
            retval.addSection( new Rational( NT[0], DT[0] ) );
            retval.addSection( new Rational( NT[1], DT[1] ) );
View Full Code Here

        double   root = ( -b + Math.sqrt(discriminant) ) / 2.0;
        double   f1   = root*BW/2.0;
        double   f2   = f1*f1 - prod;
        Complex  C    = new Complex( f1 ).plus( Complex.sqrt( new Complex(f2) ) );
        double[] t0   = { C.conjugate().times(C).real(), -2.0*C.real(), 1.0 };
        retval[0]     = new Polynomial( t0 );
           
        root = ( -b -Math.sqrt(discriminant) ) / 2.0;
        f1   = root*BW/2.0;
        f2   = f1*f1 - prod;
        C    = new Complex( f1 ).plus( Complex.sqrt( new Complex(f2) ) );
        double[] t1 = { C.conjugate().times(C).real(), -2.0*C.real(), 1.0 };
        retval[1]     = new Polynomial( t1 );
      }
      else {
        Complex root = new Complex( -b/2.0, Math.sqrt( -discriminant ) / 2.0 );
       
        Complex f1  = root.times( BW/2.0 );
        Complex f2  = (f1.times(f1)).minus( prod );
        Complex C   = f1.plus( Complex.sqrt( f2 ) );
        double[] t0 = { C.conjugate().times(C).real(), -2.0*C.real(), 1.0 };
        retval[0]   = new Polynomial( t0 );
           
        C = f1.minus( Complex.sqrt( f2 ) );
        double[] t1 = { C.conjugate().times(C).real(), -2.0*C.real(), 1.0 };
        retval[1]   = new Polynomial( t1 );
      }
     
      return retval;
    }
View Full Code Here

TOP

Related Classes of DSP.filter.Polynomial

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.