Main Content

sldiscmdl

Discretize model that contains continuous blocks

Syntax

sldiscmdl('model_name',sample_time)
sldiscmdl('model_name',sample_time,method)
sldiscmdl('model_name',sample_time,options)
sldiscmdl('model_name',sample_time,method,freq)
sldiscmdl('model_name',sample_time,method,options)
sldiscmdl('model_name',sample_time,method,freq,options)
[old_blks,new_blks] = sldiscmdl('model_name',sample_time,method,freq,options)

Description

sldiscmdl('model_name',sample_time) discretizes the model named 'model_name' using the specified sample_time. The model does not need to be open, and the units for sample_time are simulation seconds.

sldiscmdl('model_name',sample_time,method) discretizes the model using sample_time and the transform method specified by method.

sldiscmdl('model_name',sample_time,options) discretizes the model using sample_time and criteria specified by the options cell array. This array consists of four elements: {target, replace_with, put_into, prompt}.

sldiscmdl('model_name',sample_time,method,freq) discretizes the model using sample_time, method, and the critical frequency specified by freq. The units for freq are Hz. When you specify freq, method must be 'prewarp'.

sldiscmdl('model_name',sample_time,method,options) discretizes the model using sample_time, method, and options.

sldiscmdl('model_name',sample_time,method,freq,options) discretizes the model using sample_time, method, freq, and options. When you specify freq, method must be 'prewarp'.

[old_blks,new_blks] = sldiscmdl('model_name',sample_time,method,freq,options) discretizes the model using sample_time, method, freq, and options. When you specify freq, method must be 'prewarp'. The function also returns two cell arrays that contain full path names of the original, continuous blocks and the new, discretized blocks.

Input Arguments

model_name

Name of the model to discretize.

sample_time

Sample-time specification for the model:

Scalar value

Sample time with zero offset, such as 1

Two-element vector

Sample time with nonzero offset, such as [1 0.1]

method

Method of converting blocks from continuous to discrete mode:

'zoh' (default)

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 single-input, single-output (SISO) systems only

freq

Critical frequency in Hz. This input applies only when the method input is 'prewarp'.

options

Cell array {target, replace_with, put_into, prompt}, where each element can take the following values:

target

'all' (default)

Discretize all continuous blocks

'selected'

Discretize only selected blocks in the model

'full_blk_path'

Discretize specified block

replace_with

'parammask' (default)

Create discrete blocks whose parameters derive from the corresponding continuous blocks

'hardcoded'

Create discrete blocks with hard-coded parameters placed directly into each block dialog box

put_into

'copy' (default)

Create discretization in a copy of the original model

'variant'

Create discretization candidate in a variant subsystem

'current'

Apply discretization to the current model

'untitled'

Create discretization in a new untitled window

prompt

'on' (default)

Show discretization information at the command prompt

'off'

Do not show discretization information at the command prompt

Examples

Discretize all continuous blocks in the slexAircraftExample model using a 1-second sample time:

openExample('slexAircraftExample');
sldiscmdl('slexAircraftExample',1);

Discretize the Aircraft Dynamics Model subsystem in the slexAircraftExample model using a 1-second sample time, a 0.1-second offset, and a first-order hold transform method:

sldiscmdl('slexAircraftExample',[1 0.1],'foh',...
{'slexAircraftExample/Aircraft Dynamics Model',... 
'parammask','copy','on'});

Discretize the Aircraft Dynamics Model subsystem in the slexAircraftExample model and retrieve the full path name of the second discretized block:

[old_blks,new_blks] = sldiscmdl('slexAircraftExample',[1 0.1],...
'foh',{'slexAircraftExample/Aircraft Dynamics Model','parammask',...
'copy','on'});
% Get full path name of the second discretized block
new_blks{2}

Discretize all continuous blocks in the slexAircraftExample model using a 1-second sample time:

openExample('slexAircraftExample');
[old_blk,new_blk] = sldiscmdl('f14',1,'zoh',...
{'f14/Aircraft Dynamics Model',...
'parammask','variant','on'})
--discretizing 'f14/Aircraft Dynamics Model' and putting results into a variant subsystem

old_blk =

  1x1 cell array

    {'f14/Aircraft Dynamics Model'}

new_blk =

  1x1 cell array

    {'f14/Aircraft↵Dynamics↵Model'}

Version History

Introduced before R2006a