www.gusucode.com > robust 案例源码程序 matlab代码 > robust/FitDscaleDataExample.m
%% Fit D-scale Data % Use the |fitfrd| command to fit _D_-scale data. %% % Create _D_-scale frequency response data from a fifth-order system. % Copyright 2015 The MathWorks, Inc. sys = tf([1 2 2],[1 2.5 1.5])*tf(1,[1 0.1]); sys = sys*tf([1 3.75 3.5],[1 2.5 13]); omeg = logspace(-1,1); sysg = frd(sys,omeg); bode(sysg,'r-'); %% % You can try to fit the frequency response _D_-scale data |sysg| with a % first-order system, |b1|. Similarly, you can fit the % _D_-scale data with a third-order system, |b3|. b1 = fitfrd(sysg,1); b3 = fitfrd(sysg,3); %% % Compare the original _D_-scale data |sysg| with the frequency responses % of the first and third-order models calculated by |fitfrd|. b1g = frd(b1,omeg); b3g = frd(b3,omeg); bode(sysg,'r-',b1g,'k:',b3g,'b-.') legend('5th order system','1st order fit','3rd order fit','Location','Southwest')