## Modelica_LinearSystems2.WorkInProgress.TransferFunction.Examples

### Package Content

Name | Description
--- | ---
plotBodeDiscrete | Plot the Bode diagram of the continuous and the discrete transfer functions with automatic determination of the frequency range to plot

## Modelica_LinearSystems2.WorkInProgress.TransferFunction.Examples.plotBodeDiscrete

Plot the Bode diagram of the continuous and the discrete transfer functions with automatic determination of the frequency range to plot

### Outputs

Type | Name | Description
--- | --- | ---
Boolean | ok |

### Modelica definition

    function plotBodeDiscrete
      "Plot the Bode diagram of the continuous and the discrete transfer functions with automatic determination of the frequency range to plot"

      import Modelica.Utilities.Streams.print;
      import Modelica_LinearSystems2.Math.Complex;
      import Modelica_LinearSystems2.TransferFunction;
      import Modelica_LinearSystems2.WorkInProgress.DiscreteTransferFunction;

      output Boolean ok;
    protected
      Modelica.SIunits.Time Ts = 0.1 "Sample time";
      Modelica_LinearSystems2.Types.Method method=Modelica_LinearSystems2.Types.Method.StepExact
        "Discretization method";
      TransferFunction tf=TransferFunction({1}, {1,0,1});
      Modelica_LinearSystems2.WorkInProgress.DiscreteTransferFunction dtf=
                                   Modelica_LinearSystems2.WorkInProgress.DiscreteTransferFunction(
                                                            tf,Ts,method);

    algorithm
      Modelica_LinearSystems2.TransferFunction.Plot.bode(tf);
      Modelica_LinearSystems2.DiscreteTransferFunction.Plot.bode(dtf);
      ok := true;

    end plotBodeDiscrete;