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

    %% Linearize Model at Specified Operating Point
%%
% Open the Simulink model.
sys = 'magball';
open_system(sys)

%%
% Find a steady-state operating point at which the ball height is |0.05|.
% Create a default operating point specification, and set the height state
% to a known value.
opspec = operspec(sys); 
opspec.States(5).Known = 1;
opspec.States(5).x = 0.05;

%%
% Trim the model to find the operating point.
options = findopOptions('DisplayReport','off');
op = findop(sys,opspec,options);

%%
% Specify linearization input and output signals to compute the closed-loop
% transfer function.
io(1) = linio('magball/Desired Height',1,'input');
io(2) = linio('magball/Magnetic Ball Plant',1,'output');

%%
% Linearize the model at the specified operating point using the specified
% I/O set.
linsys = linearize(sys,io,op);