% Routine 10.1 Bode Plots % % JV (10/22/2002): modified with subplots to illustrate % the effects of the Q in filter (10.20) % fmin = 0; % min freq (in Hz) to view fmax = .5; % max freq (in Hz) to view df = 0.01; % step size f = fmin:df:fmax; % frequency vector w = 2*pi*f; % radian freq vector s = w*i; Q = 2; N = s./Q; % numerator of transfer fn D = s.*s + s./Q + 1; % denominator H = N./D; % transfer fn r = abs(H); % gain at freq w phi = angle(H); % phase lead subplot(2,2,1) plot(f,r) % gain vs freq in Hz for Q = 2 Q = 4; N = s./Q; % numerator of transfer fn D = s.*s + s./Q + 1; % denominator H = N./D; % transfer fn r = abs(H); % gain at freq w phi = angle(H); % phase lead subplot(2,2,2) plot(f,r) % gain vs freq in Hz for Q = 4 Q = 8; N = s./Q; % numerator of transfer fn D = s.*s + s./Q + 1; % denominator H = N./D; % transfer fn r = abs(H); % gain at freq w phi = angle(H); % phase lead subplot(2,2,3) plot(f,r) % gain vs freq in Hz for Q = 8 Q = 16; N = s./Q; % numerator of transfer fn D = s.*s + s./Q + 1; % denominator H = N./D; % transfer fn r = abs(H); % gain at freq w phi = angle(H); % phase lead subplot(2,2,4) plot(f,r) % gain vs freq in Hz for Q = 16