Main Content


Get rate conversion settings for tuned block in slTuner interface


When you use systune with Simulink®, tuning is performed at the sampling rate specified by the Ts property of the slTuner interface. When you use writeBlockValue to write tuned parameters back to the Simulink model, each tuned block value is automatically converted from the sample time used for tuning, to the sample time of the Simulink block. The rate conversion method associated with each tuned block specifies how this resampling operation should be performed. Use getBlockRateConversion to query the block conversion rate and use setBlockRateConversion to modify it.

method = getBlockRateConversion(st,blk) returns the rate conversion method associated with the tuned block, blk.

[method,pwf] = getBlockRateConversion(st,blk) also returns the prewarp frequency. When method is not 'tustin', the prewarp frequency is always 0.


[IF,DF] = getBlockRateConversion(st,blk) returns the discretization methods for the integrator and derivative filter terms when blk is a PID Controller block.


collapse all

Create an slTuner interface for the Simulink model scdcascade. Examine the block rate conversion settings of one of the tuned blocks.

st = slTuner('scdcascade',{'C1','C2'});

[IF,DF] = getBlockRateConversion(st,'C1')
IF =


DF =


C1 is a PID block. Therefore, its rate-conversion settings are expressed in terms of integrator and derivative filter methods. For a continuous-time PID block, the rate-conversion methods are set to Trapezoidal by default. To override this setting, use setBlockRateConversion.

Input Arguments

collapse all

Interface for tuning control systems modeled in Simulink, specified as an slTuner interface.

Block in the list of tuned blocks for st, specified as a character vector or string. You can specify the full block path or any portion of the block path that uniquely identifies the block among the other tuned blocks of st.

Example: blk = 'scdcascade/C1', blk = "C1"

Output Arguments

collapse all

Rate conversion method associated with blk, returned as one of the following:

  • 'zoh' — Zero-order hold on the inputs

  • 'foh — Linear interpolation of inputs

  • 'tustin' — Bilinear (Tustin) approximation

  • 'matched' — Matched pole-zero method (for SISO blocks only)

Prewarp frequency for the Tustin method, returned as a positive scalar.

If the rate conversion method associated with blk is zero-order hold or Tustin without prewarp, then pwf is 0.

Integrator and filter methods for rate conversion of PID Controller block, each returned as 'ForwardEuler', 'BackwardEuler', or 'Trapezoidal'. For continuous-time PID blocks, the default methods are 'Trapezoidal' for both integrator and derivative filter. For discrete-time PID blocks, IF and DF are determined by the Integrator method and Filter method settings in the Simulink block. See the Discrete PID Controller and pid reference pages for more details about integrator and filter methods.

More About

collapse all

Tuned Blocks

Tuned blocks, used by the slTuner interface, identify blocks in a Simulink model whose parameters are to be tuned to satisfy tuning goals. You can tune most Simulink blocks that represent linear elements such as gains, transfer functions, or state-space models. (For the complete list of blocks that support tuning, see How Tuned Simulink Blocks Are Parameterized). You can also tune more complex blocks such as SubSystem or S-Function blocks by specifying an equivalent tunable linear model.

Use tuning commands such as systune to tune the parameters of tuned blocks.

You must specify tuned blocks (for example, C1 and C2) when you create an slTuner interface.

st = slTuner('scdcascade',{'C1','C2'})

You can modify the list of tuned blocks using addBlock and removeBlock.

To interact with the tuned blocks use:

Version History

Introduced in R2014a