Main Content

使用 System Identification Toolbox 估计含噪频率响应模型

打开 Simulink® 模型,并指定要线性化的模型部分:

load_system('magball');
io(1) = linio('magball/Desired Height',1);
io(2) = linio('magball/Magnetic Ball Plant',1,'output');

计算稳态工作点,并线性化模型:

op = findop('magball',operspec('magball'),...
                      findopOptions('DisplayReport','off'));
sys = linearize('magball',io,op);

创建一个啁啾信号,并使用它来估计频率响应:

in = frest.Chirp('FreqRange',[1 1000],...
                             'Ts',0.001,...
                             'NumSamples',1e4);
[~,simout] = frestimate('magball',io,op,in);

使用 System Identification Toolbox™ 软件估计一个五阶状态空间模型。比较解析线性化和状态空间模型的结果:

input = generateTimeseries(in);
output = simout{1}.Data;
data = iddata(output,input.Data(:),in.Ts);
sys_id = n4sid(detrend(data),5,'cov','none');
bodemag(sys,ss(sys_id('measured')),'r')
legend('Linear model obtained using LINEARIZE',...
       'State-space model using System Identification Toolbox',...
       'Location','SouthWest')