www.gusucode.com > slcontrol 案例源码程序 matlab代码 > slcontrol/SetValueOfTunableElementWithinCustomParameterizationExample.m

    %% Set Value of Single Tunable Element within Custom Parameterization  

% Copyright 2015 The MathWorks, Inc.


%% 
% Create an |slTuner| interface for the |scdcascade| model.  
open_system('scdcascade');
st = slTuner('scdcascade',{'C1','C2'});

%%
% Set a custom parameterization for one of the tunable blocks.
C1CustParam = realp('Kp',1) + tf(1,[1 0]) * realp('Ki',1);
setBlockParam(st,'C1',C1CustParam); 

%%
% These commands set the parameterization of the |C1| controller block to
% a generalized state-space (|genss|) model containing two tunable parameters,
% |Ki| and |Kp|.

%% 
% Initialize the value of |Ki| to |10| without changing the value of Kp.
setTunedValue(st,'Ki',10);