.Modelica_LinearSystems2.TransferFunction.Design.filter

Information

Syntax

filterFunction = TransferFunction.Design.filter(analogFilter, filterType, order, f_cut, gain, A_ripple, normalized)

Description

This function constructs a transfer function description of low and high pass filters. For more details see also [Tietze2002], pp. 815-852.

Typical frequency responses for the four supported low pass filter types are shown in the next figure (this figure was generated with function Examples.TransferFunction.plotBodeFilter2):

The step responses of the same low pass filters are shown in the next figure, starting from a steady state initial filter with initial input = 0.2:

Obviously, the frequency responses give a somewhat wrong impression of the filter characteristics: Although Butterworth and Chebyshev filters have a significantly steeper magnitude as the CriticalDamping and Bessel filters, the step responses of the latter ones are much better. This means for example, that a CriticalDamping or a Bessel filter should be selected, if a filter is mainly used to make a non-linear inverse model realizable.

Typical frequency responses for the four supported high pass filter types are shown in the next figure:

The corresponding step responses of these high pass filters are shown in the next figure:

All filters are available in normalized (default) and non-normalized form. In the normalized form, the amplitude of the filter transfer function at the cutoff frequency is 1/sqrt(2) (= 3 dB). Note, when comparing the filters of this function with other software systems, the setting of "normalized" has to be selected appropriately. For example, the signal processing toolbox of Matlab provides the filters in non-normalized form and therefore a comparison makes only sense, if normalized = false is set.

Example

  Types.AnalogFilter analogFilter=Modelica_LinearSystems2.Types.AnalogFilter.CriticalDamping;
  Integer order=2;
  Modelica.Units.SI.Frequency f_cut=10;

  TransferFunction tf_filter;

algorithm
  tf_filter=Modelica_LinearSystems2.TransferFunction.Design.filter(
    order=order,
    f_cut=f_cut,
    analogFilter=analogFilter);

// tf_filter = 9530.93/(s^2 + 195.253*s + 9530.93)

Interface

encapsulated function filter
  import Modelica;
  import Modelica_LinearSystems2;
  import Modelica_LinearSystems2.TransferFunction;
  import Modelica_LinearSystems2.ZerosAndPoles;
  input Modelica_LinearSystems2.Utilities.Types.AnalogFilter analogFilter = Modelica_LinearSystems2.Utilities.Types.AnalogFilter.CriticalDamping "Analog filter characteristics (CriticalDamping/Bessel/Butterworth/Chebyshev)";
  input Modelica_LinearSystems2.Utilities.Types.FilterType filterType = Modelica_LinearSystems2.Utilities.Types.FilterType.LowPass "Type of filter (LowPass/HighPass)";
  input Integer order(min = 1) = 2 "Order of filter";
  input Modelica.Units.SI.Frequency f_cut = 1/(2*Modelica.Constants.pi) "Cut-off frequency (default is w_cut = 1 rad/s)";
  input Real gain = 1.0 "Gain (= amplitude of frequency response at zero frequency)";
  input Real A_ripple(unit = "dB") = 0.5 "Pass band ripple for Chebyshev filter (otherwise not used)";
  input Boolean normalized = true "True, if amplitude of low pass filter at f_cut where the magnitude of the filter sagged for 3dB, otherwise unmodified filter";
  output TransferFunction filter "Filter transfer function";
end filter;

Generated at 2024-11-22T19:25:38Z by OpenModelicaOpenModelica 1.24.2 using GenerateDoc.mos