Simulink Reference | ![]() ![]() |
Discretize a Simulink model containing continuous blocks
Syntax
sldiscmdl('
sys'
,sampletime) sldiscmdl('
sys'
,sampletime,'
method'
) sldiscmdl('
sys'
,sampletime,{options}) sldiscmdl('
sys'
,sampletime,'
method'
,cf) sldiscmdl('
sys'
,sampletime,'
method'
,{options}) sldiscmdl('
sys'
,sampletime,'
method'
,cf,{options})
Description
discretizes the model specified by sldiscmdl('sys',sampletime)
'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.
discretizes the model with the transform method specified by sldiscmdl('sys',sampletime,'method')
'method'
. Available values for 'method'
are shown below:
discretizes the model with the criteria specified by sldiscmdl('sys',sampletime,{options})
{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:
Available values for 'PutInto'
are shown below:
Available values for 'prompt'
are shown below:
Value |
Description |
'on' |
Show the discretization information |
'off' |
Do not show the discretization information |
discretizes the model with the critical frequency specified by sldiscmdl('sys',sampletime,'method',cf)
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.
[a, b] = sldiscmdl('f14',[1.0 0.1],'zoh', {'f14/Controller',... 'hardcoded', 'copy', 'on'}) a = [1x43 char] [1x37 char] [1x53 char] [1x30 char] b = [1x43 char] [1x37 char] [1x53 char] [1x30 char]
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 | ![]() |