From graphics-request at octave dot org Thu Aug 5 13:11:21 2004 Subject: Re: freqz_plot alterations From: Daniel J Sebald To: "John W. Eaton" , graphics@octave.org Date: Thu, 05 Aug 2004 13:35:54 -0500 This is a multi-part message in MIME format. --------------070305080505080307020501 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Daniel J Sebald wrote: > For anyone interested, attached are some slight alterations > to the freqz_plot.m file. The three plots are made to have the > same height and the tics for the phase angle are made more > congruous with 5, 15, 30, 45, 60, etc (Being able to specify a > sample rate, i.e., non-normalized frequency would be nice, > but probably not compatible.) Sorry, I forgot the unified flag. A new diff file is attached. Also, I've noticed a roundoff problem with the right border using gnuplot. Sometimes the right border is slightly to the left of the vertical grid line and tic. The issue is that axis ([ w(1), w(n), maxmag-3, maxmag ]); translates to gset xrange [0:1.99805] (i.e., w(n) = 1.99805) which causes the aberration, whereas gset xrange [0:2] avoids the aberration. I've posted to the gnuplot beta list wondering if this is gnuplot's problem or not. (My opinion is that it is.) Dan --------------070305080505080307020501 Content-Type: text/plain; name="freqz_plot.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="freqz_plot.patch" --- /usr/src/redhat/SOURCES/octave-2.1.57/scripts/signal/freqz_plot.m Mon Nov 24 21:59:41 2003 +++ freqz_plot-2.1.57-mod.m Thu Aug 5 13:15:48 2004 at @ -1,3 +1,14 @@ +## EXPERIMENTAL CODE!!! by Dan Sebald. (Aug 5, 2004) +## +## This file is NOT part of the Octave distribution. +## +## This file is a variation of the freqz_plot.m file from version +## 2.1.57. The plot locations are changed so that all plot heights +## are the same. Also, the phase plot attempts to choose a more +## appropriate tic for angles. +## +## ===================================================================== +## ## Copyright (C) 2002 John W. Eaton ## ## This file is part of Octave. at @ -45,6 +56,10 @@ automatic_replot = 0; subplot (311); + gset size 1,0.26; + gset origin 0,0.72; + gset bmargin 0; + gset tmargin 0; gset lmargin 10; axis ("labely"); xlabel (""); at @ -52,11 +67,10 @@ axis ([ w(1), w(n), maxmag-3, maxmag ]); plot (w, mag, ";Pass band (dB);"); - subplot (312); + gset origin 0,0.42; axis ("labely"); title (""); xlabel (""); - gset tmargin 0; grid ("on"); if (maxmag - min (mag) > 100) axis ([ w(1), w(n), maxmag-100, maxmag ]); at @ -65,10 +79,28 @@ endif plot (w, mag, ";Stop band (dB);"); - subplot (313); + gset origin 0,0.12; axis ("label"); title (""); grid ("on"); + phasediff = (max (phase) - min (phase))*360/(2*pi); + if (phasediff < 5) + gset ytics autofreq; + elseif (phasediff < 30) + gset ytics 5; + elseif (phasediff < 90) + gset ytics 15; + elseif (phasediff < 180) + gset ytics 30; + elseif (phasediff < 240) + gset ytics 45; + elseif (phasediff < 360) + gset ytics 60; + elseif (phasediff < 540) + gset ytics 90; + else + gset ytics autofreq; + endif axis ("autoy"); xlabel ("Frequency"); axis ([ w(1), w(n) ]); at @ -86,6 +118,8 @@ axis ("auto", "label"); gset lmargin; gset tmargin; + gset bmargin; + gset ytics autofreq; oneplot (); automatic_replot = replot_state; --------------070305080505080307020501--