changeset 3907:437884fae441

[project @ 2002-04-24 19:33:08 by jwe]
author jwe
date Wed, 24 Apr 2002 19:33:08 +0000
parents a7096282a091
children 90dc5c9a9a21
files scripts/ChangeLog scripts/signal/freqz.m
diffstat 2 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,9 @@
+2002-04-24  Paul Kienzle <pkienzle@users.sf.net>
+
+	* signal/freqz.m: If nargout is zero, plot results instead of
+	returning them.
+	* signal/freqz_plot.m: New file.
+
 2002-04-24  Bill Lash  <lash@tellabs.com>
 
 	* scripts/signal/unwrap.m: New file.
--- a/scripts/signal/freqz.m
+++ b/scripts/signal/freqz.m
@@ -63,11 +63,14 @@
 ## @var{Fs}.  If you are evaluating the response at specific frequencies 
 ## @var{w}, those frequencies should be requested in Hz rather than radians.
 ##
+## @deftypefnx {Function File} freqz(@dots{})
+## Plot the pass band, stop band and phase response of @var{h} rather
+## than returning them.
 ## @end deftypefn
 
 ## Author: jwe ???
 
-function [h, w] = freqz (b, a, n, region, Fs)
+function [h_r, w_r] = freqz (b, a, n, region, Fs)
 
   if (nargin < 1 || nargin > 5)
     usage ("[h, w] = freqz (b, a, n [, \"whole\"] [, Fs])");
@@ -153,4 +156,11 @@
   h = hb ./ ha;
   w = Fs * w / (2*pi);
 
+  if (nargout != 0), # return values and don't plot
+    h_r = h;
+    w_r = w;
+  else             # plot and don't return values
+    freqz_plot (w, h);
+  end
+
 endfunction