No BSD License  

Highlights from
Signals & Systems: Continuous and Discrete, 4e Companion Software

from Signals & Systems: Continuous and Discrete, 4e Companion Software by Rodger Ziemer
Companion Software for Signals & Systems: Continuous and Discrete, 4e

AEex6.m
n = 2;                            % Define order
Wn = 1;                           % Define 3-dB freq in rad/s
Wo = 2*pi*60;                     % fc in rad/s (Wc)
Wb = 2*pi*2;                      % fb in rad/s (Wb)
[b,a] = butter(n,Wn,'s');         % Establish analog prototype
[bt,at] = lp2bs(b,a,Wo,Wb);       % Convert to bandstop filter
bt                                % Display numerator coefficients      
at                                % Display denominator coefficifents

% The rest of this file is to do the plot.

w = 2*pi*logspace(1,2,500);       % Compute freq. vector in rad/s
h = freqs(bt,at,w);               % Compute frequency response
mag = 20*log10(abs(h));           % Determine amplitude response
f=w/(2*pi);                       % Convert to Hz for plot
semilogx(f,mag)               	  % Execute plot
xlabel('Frequency - Hz')          % Label x axis
ylabel('Amplitude Response - dB') % Label y axis

Contact us at files@mathworks.com