Simulink Reference    
sldiscmdl

Discretize a Simulink model containing continuous blocks

Syntax

Description

sldiscmdl('sys',sampletime) discretizes the model specified by 'sys' and sampletime. You can enter a sample time and an offset as a 2-element vector for sampletime. The units for sampletime are seconds.

sldiscmdl('sys',sampletime,'method') discretizes the model with the transform method specified by 'method'. Available values for 'method' are shown below:

Value
Description
'zoh'
Zero-order hold on the inputs
'foh'
First-order hold on the inputs
'tustin'
Bilinear (Tustin) approximation
'prewarp'
Tustin approximation with frequency prewarping
'matched'
Matched pole-zero method (for SISO systems only)

sldiscmdl('sys',sampletime,{options}) discretizes the model with the criteria specified by {options}, where {options} is a cell array containing the following string elements:

{'target','ReplaceWith','PutInto','prompt'}

Available values for 'target' are shown below:

Value
Description
'all'
Discretize all continuous blocks
'selected'
Discretize selected blocks only
'<full path name of block>'
Discretize specified block

Available values for 'ReplaceWith' are shown below:

Value
Description
'parammask'
Create discrete blocks whose parameters are retained from the corresponding continuous block
'hardcoded'
Create discrete blocks whose parameters are "hard_coded" values placed directly into the block's dialog

Available values for 'PutInto' are shown below:

Value
Description
'current'
Apply discretization to current model
'configurable'
Create discretization candidate in a configurable subsystem
'untitled'
Create discretization in a new untitled window
'copy'
Create discretization in copy of the original model

Available values for 'prompt' are shown below:

Value
Description
'on'
Show the discretization information
'off'
Do not show the discretization information

sldiscmdl('sys',sampletime,'method',cf) discretizes the model with the critical frequency specified by cf. The units for cf are Hz. This is only used when the transform method is 'prewarp'.

Examples

This command discretizes all of the continuous blocks in the f14 model with a 1 second sample time.

This command discretizes the Controller subsystem in the f14 model using a first-order hold transform method with a 1 second sample time and a 0.1 second sample time offset. The discretized block has "hard-coded" parameters that are placed directly into the block's dialog box.

This command discretizes the Controller subsystem in the f14 model using a zero-order hold transform method with a 1 second sample time and a 0.1 second sample time offset. It returns to the command window a cell array for the original continuous blocks in the system and a cell array for the discretized blocks in the system.

You can index into the cell arrays to get the new names of the discretized blocks and the original names of the continuous blocks.

For example, this command returns the name of the second discretized block.


  simulink slmdldiscui