Replace or update control design blocks in generalized LTI model
Mnew = replaceBlock(M,Block1,Value1,...,BlockN,ValueN)
Mnew = replaceBlock(M,blockvalues)
Mnew = replaceBlock(...,mode)
replaces the Control Design
Mnew = replaceBlock(
M with the specified
M is a Generalized LTI model or a Generalized matrix.
If a specified
Replacement values for the corresponding blocks
The replacement value for a block can be any value compatible with the
size of the block, including a different Control Design Block, a numeric
matrix, or an LTI model. If any value is
Structure specifying blocks of
The field names of
Block replacement mode for an input array
When the input
Matrix or linear model or matrix where the specified blocks are replaced by the specified replacement values.
Replace Control Design Block with Numeric Values
This example shows how to replace a tunable PID controller (
tunablePID) in a Generalized LTI
model by a pure gain, a numeric PI controller, or the current value of the tunable
Create a Generalized LTI model of the following system:
where the plant , and C is a tunable PID controller.
G = zpk(1,[-1,-1,-1],1); C = tunablePID('C','pid'); Try = feedback(G*C,1)
Cby a pure gain of 5.
T1 = replaceBlock(Try,'C',5);
ssmodel that equals
Cby a PI controller with proportional gain of 5 and integral gain of 0.1.
C2 = pid(5,0.1); T2 = replaceBlock(Try,'C',C2);
ssmodel that equals
Cby its current (nominal) value.
T3 = replaceBlock(Try,'C',);
Chas been replaced by
Sample Tunable Model Over Grid of Values
Consider the second-order filter represented by:
Sample this filter at varying values of the damping constant and the natural frequency . Create a tunable model of the filter by using tunable elements for and .
wn = realp('wn',3); zeta = realp('zeta',0.8); F = tf(wn^2,[1 2*zeta*wn wn^2])
Generalized continuous-time state-space model with 1 outputs, 1 inputs, 2 states, and the following blocks: wn: Scalar parameter, 5 occurrences. zeta: Scalar parameter, 1 occurrences. Type "ss(F)" to see the current value and "F.Blocks" to interact with the blocks.
Create a grid of sample values.
wnvals = [3;5]; zetavals = [0.6 0.8 1.0]; [wngrid,zetagrid] = ndgrid(wnvals,zetavals); Fsample = replaceBlock(F,'wn',wngrid,'zeta',zetagrid); size(Fsample)
2x3 array of state-space models. Each model has 1 outputs, 1 inputs, and 2 states.
The ndgrid command produces a full 2-by-3 grid of parameter combinations. Thus,
Fsample is a 2-by-3 array of state-space models. Each entry in the array is a state-space model that represents
F evaluated at the corresponding (
zeta) pair. For example,
wn = 5 and
zeta = 1.0.
Pole Damping Frequency Time Constant (rad/seconds) (seconds) -5.00e+00 1.00e+00 5.00e+00 2.00e-01 -5.00e+00 1.00e+00 5.00e+00 2.00e-01
replaceBlockto perform parameter studies by sampling Generalized LTI models across a grid of parameters, or to evaluate tunable models for specific values of the tunable blocks. See Examples.
For additional options for sampling control design blocks, including concurrent sampling, use
To take random samples of control design blocks, see
Introduced in R2011a