%  Example 5.5.  Compare frequency weighting with the transfer function 
%    approximation.
clear
%  Define the frequency weighting.
omega=[1,10,1000,10000];
W=[0.005 0.005 0.5 0.5];
%  Define the transfer function approximation.
nu=0.5*[1 10];
de=[1 1000];
%  Compute frequency response for transfer function approximation.
w=logspace(0,4);
[mag,pha]=bode(nu,de,w);
%  Plot the weighting function and the magnitude of the transfer function
%  approximation.
set(0,'DefaultAxesFontName','times')
set(0,'DefaultAxesFontSize',16)
set(0,'DefaultTextFontName','times')
figure(1)
clf
loglog(omega,W,'r-',w,mag,'r--')
xlabel('Frequency (rad/sec)')
ylabel('Gain')
legend('Actual','Approximation')
grid
