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

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

%% 
% Both |C1| and |C2| are PI controllers. Examine the default parameterization
% of |C1|. 
getBlockParam(st,'C1') 

%%
% The default parameterization is a tunable PI controller (|tunablePID|).  

%% 
% Parameterize |C1| as a proportional controller, with only one tunable 
% parameter, |Kp|. 
G = tunableGain('C1',4.2);

setBlockParam(st,'C1',G); 

%%
% Tuning commands, such as |systune|, now use this proportional controller
% parameterization of the |C1| block of |st|. 

%%
% This custom parameterization is compatible with the default parameterization
% of the Simulink(R) block. Therefore, you can use |writeBlockValue| to
% write the tuned values back to the block.