Figure J.4 lists a Matlab function for plotting frequency-response magnitude and phase. (See also Fig.7.1.) Since Octave does not yet support saving multiple ``subplots'' to disk for later printing, we do not have an Octave-compatible version here. At present, Matlab's graphics support is much more extensive and robust than that in Octave's (which is based on a shaky and Matlab-incompatible interface to gnuplot). Another free alternative to consider for making nice Matlab-style 2D plots is matplotlib.
function [plothandle] = plotfr(X,f); % PLOTFR - Plot frequency-response magnitude & phase. % Requires Mathworks Matlab. % % X = frequency response % f = vector of corresponding frequency values Xm = abs(X); % Amplitude response Xmdb = 20*log10(Xm); % Prefer dB for audio work Xp = angle(X); % Phase response if nargin<2, N=length(X); f=(0:N-1)/(2*(N-1)); end subplot(2,1,1); plot(f,Xmdb,'-k'); grid; ylabel('Gain (dB)'); xlabel('Normalized Frequency (cycles/sample)'); axis tight; text(-0.07,max(Xmdb),'(a)'); subplot(2,1,2); plot(f,Xp,'-k'); grid; ylabel('Phase Shift (radians)'); xlabel('Normalized Frequency (cycles/sample)'); axis tight; text(-0.07,max(Xp),'(b)'); if exist('OCTAVE_VERSION') plothandle = 0; % gcf undefined in Octave else plothandle = gcf; end