highPass

Return high pass filter roots as needed for block for given cut-off frequency

Information

This information is part of the Modelica Standard Library maintained by the Modelica Association.

The goal is to implement the filter in the following form:

// real pole:
 der(x) = r*x - r*u
     y  = -x + u

// complex conjugate poles:
der(x1) = a*x1 - b*x2 + ku*u;
der(x2) = b*x1 + a*x2;
     y  = k1*x1 + k2*x2 + u;

          ku = (a^2 + b^2)/b
          k1 = 2*a/ku
          k2 = (a^2 - b^2) / (b*ku)
             = (a^2 - b^2) / (a^2 + b^2)
             = (1 - (b/a)^2) / (1 + (b/a)^2)

This representation has the following transfer function:

// real pole:
    s*x = r*x - r*u
  or
    (s-r)*x = -r*u   -> x = -r/(s-r)*u
  or
    y = r/(s-r)*u + (s-r)/(s-r)*u
      = (r+s-r)/(s-r)*u
      = s/(s-r)*u

// comparing coefficients with
    y = s/(s + cr)*u  ->  r = -cr      // r is the real eigenvalue

// complex conjugate poles
    s*x2 =  a*x2 + b*x1
    s*x1 = -b*x2 + a*x1 + ku*u
  or
    (s-a)*x2               = b*x1  ->  x2 = b/(s-a)*x1
    (s + b^2/(s-a) - a)*x1 = ku*u  ->  (s(s-a) + b^2 - a*(s-a))*x1  = ku*(s-a)*u
                                   ->  (s^2 - 2*a*s + a^2 + b^2)*x1 = ku*(s-a)*u
  or
    x1 = ku*(s-a)/(s^2 - 2*a*s + a^2 + b^2)*u
    x2 = b/(s-a)*ku*(s-a)/(s^2 - 2*a*s + a^2 + b^2)*u
       = b*ku/(s^2 - 2*a*s + a^2 + b^2)*u
    y  = k1*x1 + k2*x2 + u
       = (k1*ku*(s-a) + k2*b*ku +  s^2 - 2*a*s + a^2 + b^2) /
         (s^2 - 2*a*s + a^2 + b^2)*u
       = (s^2 + (k1*ku - 2*a)*s + k2*b*ku - k1*ku*a + a^2 + b^2) /
         (s^2 - 2*a*s + a^2 + b^2)*u
       = (s^2 + (2*a-2*a)*s + a^2 - b^2 - 2*a^2 + a^2 + b^2) /
         (s^2 - 2*a*s + a^2 + b^2)*u
       = s^2 / (s^2 - 2*a*s + a^2 + b^2)*u

// comparing coefficients with
    y = s^2/(s^2 + c1*s + c0)*u  ->  a = -c1/2
                                     b = sqrt(c0 - a^2)

// comparing with eigenvalue representation:
    (s - (a+jb))*(s - (a-jb)) = s^2 -2*a*s + a^2 + b^2
// shows that:
//   a: real part of eigenvalue
//   b: imaginary part of eigenvalue

Syntax

(r, a, b, ku, k1, k2) = highPass(cr_in, c0_in, c1_in, f_cut)

Inputs (4)

cr_in

Type: Real[:]

Description: Coefficients of real poles of base filter

c0_in

Type: Real[:]

Description: Coefficients of s^0 term of base filter if conjugate complex pole

c1_in

Type: Real[size(c0_in, 1)]

Description: Coefficients of s^1 term of base filter if conjugate complex pole

f_cut

Type: Frequency (Hz)

Description: Cut-off frequency

Outputs (6)

r

Type: Real[size(cr_in, 1)]

Description: Real eigenvalues

a

Type: Real[size(c0_in, 1)]

Description: Real parts of complex conjugate eigenvalues

b

Type: Real[size(c0_in, 1)]

Description: Imaginary parts of complex conjugate eigenvalues

ku

Type: Real[size(c0_in, 1)]

Description: Gains of input terms

k1

Type: Real[size(c0_in, 1)]

Description: Gains of y = k1*x1 + k2*x + u

k2

Type: Real[size(c0_in, 1)]

Description: Gains of y = k1*x1 + k2*x + u