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

    %% Query Value of Multiple Tunable Elements 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 tunable 
% parameters |Kp| and |Ki|.

%%
% Typically, you would use a tuning command such as |systune| to tune the 
% values of the parameters in the custom parameterization.

%%
% After tuning, use |getTunedValue| to query the tuned values of both 
% |Kp| and |Ki|. 
[KiTuned,KpTuned] = getTunedValue(st,'Ki','Kp')