www.gusucode.com > robust 案例源码程序 matlab代码 > robust/DiscreteTimeWeightingFunctionsExample.m

    %% Discrete-Time Weighting Functions  
% Create discrete-time weighting functions by specifying low-frequency gain,
% high-frequency gain, crossover frequencies, and sample time.   

% Copyright 2015 The MathWorks, Inc.


%% 
% Create a weighting function with gain of 40 dB at low frequency, rolling
% off to -20 dB at high frequency. Specify a crossover frequency of 0.4
% rad/s and a sample time of 0.1 s. 
Wl = makeweight(100,.4,.10,0.1);  

%% 
% Create a weighting function with gain of -10 dB at low frequency, rising
% to 40 dB at high frequency. Specify a crossover frequency of 2 rad/s and
% a sample time of 0.1 s. 
Wh = makeweight(0.316,2,100,0.1);  

%% 
% Plot the magnitudes of the weighting functions to confirm that they meet
% the response specifications. 
bodemag(Wl,Wh)    

%%
% The high-frequency leveling of |Wh| is somewhat distorted due to the proximity
% of its crossover frequency to the Nyquist frequency.