www.gusucode.com > slcontrol 案例源码程序 matlab代码 > slcontrol/BatchTrimSimulinkModelForParameterVariationExample.m
%% Batch Trim Simulink Model for Parameter Variation %% % Open the Simulink model. sys = 'watertank'; open_system(sys) %% % Vary parametsrs |A| and |b| within 10% of their nominal values, and % create a 3-by-4 parameter grid. [A_grid,b_grid] = ndgrid(linspace(0.9*A,1.1*A,3),... linspace(0.9*b,1.1*b,4)); %% % Create a parameter structure array, specifying the name and grid points % for each parameter. params(1).Name = 'A'; params(1).Value = A_grid; params(2).Name = 'b'; params(2).Value = b_grid; %% % Create a default operating point specification for the model. opspec = operspec(sys); %% % Trim the model using the specified operating point specification and % parameter grid. opt = findopOptions('DisplayReport','off'); op = findop(sys,opspec,params,opt); %% % |op| is a 3-by-4 array of operating point objects that correspond to % the specified parameter grid points.