% Routine 10.1 Bode Plots % % JV (10/22/2002): modified with subplots % 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; N = s.*s + 1; % numerator of transfer fn D = s.*s + s + 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 subplot(2,2,2) plot(f,phi) % phase plot subplot(2,2,3) plot(f,20*log10(r)) % decibels subplot(2,2,4) plot(w,r) % gain vs radian freq