Re: freqz_plot alterations

Daniel J Sebald <[email protected]> Tue, 10 Aug 2004 14:32:56 -0500
Newsgroups gmane.comp.gnu.octave.graphics
Message-ID <[email protected]>
Here is a patch of what I suggested.  --  Dan


Daniel J Sebald wrote:

> I've been attempting to spruce up the freqz plots.  Regardless of 
> those changes, I offer up the suggestion of tweaking the 
> freqz/freqz_plot files.  The issue is that inside of the freqz_plot 
> script, the command
>
>      axis ([ w(1), w(n) ]);
>
> results in the range being forced so that the right border is not a 
> nice whole number in any case. 


Etc.
freqz_xrange.patch (text/plain, 1.2 KB)
--- /usr/src/redhat/SOURCES/octave-2.1.57/scripts/signal/freqz.m	Fri Aug  9 13:58:15 2002
+++ freqz.m	Tue Aug 10 14:23:28 2004
@@ -160,6 +160,11 @@
     h_r = h;
     w_r = w;
   else             # plot and don't return values
+    if (strcmp (region, "whole"))
+      axis ([ 0, Fs ]);
+    else
+      axis ([ 0, Fs/2 ]);
+    endif
     freqz_plot (w, h);
   end
 
--- /usr/src/redhat/SOURCES/octave-2.1.57/scripts/signal/freqz_plot.m	Mon Nov 24 21:59:41 2003
+++ freqz_plot.m	Tue Aug 10 14:27:34 2004
@@ -49,7 +49,8 @@
       axis ("labely");
       xlabel ("");
       grid ("on");
-      axis ([ w(1), w(n), maxmag-3, maxmag ]);
+      a = axis;
+      axis ([ a(1), a(2), maxmag-3, maxmag ]);
       plot (w, mag, ";Pass band (dB);");
 
       subplot (312);
@@ -59,7 +60,8 @@
       gset tmargin 0;
       grid ("on");
       if (maxmag - min (mag) > 100)
-      	axis ([ w(1), w(n), maxmag-100, maxmag ]);
+	a = axis;
+      	axis ([ a(1), a(2), maxmag-100, maxmag ]);
       else
       	axis ("autoy");
       endif
@@ -71,7 +73,6 @@
       grid ("on");
       axis ("autoy");
       xlabel ("Frequency");
-      axis ([ w(1), w(n) ]);
       plot (w, phase*360/(2*pi), ";Phase (degrees);");
       
     unwind_protect_cleanup