Examples of Rational


Examples of DSP.filter.Rational

      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

Examples of DSP.filter.Rational

    double[] td = new double[2];
    tn[0] 1.0;
    tn[1] = -1.0;
    td[0] 1.0;
    td[1] 1.0;
    Rational S = new Rational( tn, td );
   
    T = new Rational( 1.0 );
   
    sections = new ArrayList< SecondOrderSection >();
   
    for ( int i = 0;  i < prototype.nSections();  i++ ) {
      Rational R = prototype.getSection(i).map( S );
      T.timesEquals(R);
      double[] cn = R.numerator().coefficients();
      double[] cd = R.denominator().coefficients();
      double   s  = 1.0;
      if ( cd[0] != 0.0 ) s = cd[0];
     
      double b0 = cn[0]/s;
      double b1 = 0.0;
View Full Code Here

Examples of DSP.filter.Rational

    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

Examples of DSP.filter.Rational

    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

Examples of DSP.filter.Rational

    }
   
    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

Examples of DSP.filter.Rational

   * Accessor for the Rational representation of this allpass filter.
   *
   * @return      Rational object containing the rational transfer function for this filter.
   */
  public Rational rationalRepresentation() {
    return new Rational(T);
  }
View Full Code Here

Examples of DSP.filter.Rational

   *
   * @param index     int specifying the desired second order section.
   * @return          Rational object containing the representation of the desired section.
   */
  public Rational getSection( int index ) {
    return  new Rational( sections.get(index) );
  }
View Full Code Here

Examples of DSP.filter.Rational

  public AnalogPrototype lptolp( double omega0 ) {
     
    double[] tn = {0.0, 1.0};
    double[] td = { omega0 };
   
    Rational T = new Rational( tn, td );
   
    AnalogPrototype retval = new AnalogPrototype();
   
      for ( int i = 0;  i < sections.size();  i++ )
        retval.addSection( sections.get(i).map( T ) );
View Full Code Here

Examples of DSP.filter.Rational

   public AnalogPrototype lptohp( double omega0 ) {
     
      double[] tn = { omega0 };
      double[] td = { 0.0, 1.0 };
     
      Rational T = new Rational( tn, td );
     
      AnalogPrototype retval = new AnalogPrototype();
     
      for ( int i = 0;  i < sections.size();  i++ )
        retval.addSection( sections.get(i).map( T ) );
View Full Code Here

Examples of DSP.filter.Rational

      double prod = omega1*omega2;
     
        double[] tn = { prod, 0.0, 1.0 };
      double[] td = { 0.0, BW };
   
      Rational T = new Rational( tn, td );
     
      AnalogPrototype retval = new AnalogPrototype();
     
      double A = 1.0;
     
      for ( int i = 0;  i < sections.size();  i++ ) {
       
        Rational section = sections.get(i);
        Rational Tsection = section.map( T );
        A *= Tsection.canonicalForm();

        int[] order = section.order();
       
        if ( order[0] < &&  order[1] < 2 ) retval.addSection( Tsection );
       
        else if ( order[1] == 2 ) {
         
          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
TOP
Copyright © 2018 www.massapi.com. 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.