summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-core/src/utils')
-rw-r--r--gnuradio-core/src/utils/Makefile.am43
-rw-r--r--gnuradio-core/src/utils/cool.m50
-rw-r--r--gnuradio-core/src/utils/db_width.m35
-rw-r--r--gnuradio-core/src/utils/filter_tools.m42
-rw-r--r--gnuradio-core/src/utils/is_complex.m24
-rw-r--r--gnuradio-core/src/utils/lp_to_bp.m27
-rw-r--r--gnuradio-core/src/utils/partition-cascaded-decimating-filters.scm68
-rw-r--r--gnuradio-core/src/utils/permute.scm27
-rw-r--r--gnuradio-core/src/utils/plot_cic_decimator_response.m45
-rw-r--r--gnuradio-core/src/utils/plot_freq_response.m36
-rw-r--r--gnuradio-core/src/utils/plot_freq_response_db.m39
-rw-r--r--gnuradio-core/src/utils/plot_freq_response_phase.m38
-rw-r--r--gnuradio-core/src/utils/plotfft.m40
-rw-r--r--gnuradio-core/src/utils/plotfftavgk.m61
-rw-r--r--gnuradio-core/src/utils/plotfftavgk_db.m73
-rw-r--r--gnuradio-core/src/utils/plotfftk.m41
-rw-r--r--gnuradio-core/src/utils/plotfftk_db.m43
-rw-r--r--gnuradio-core/src/utils/put_markers.m32
-rw-r--r--gnuradio-core/src/utils/rainbow.m53
-rw-r--r--gnuradio-core/src/utils/read_char_binary.m45
-rw-r--r--gnuradio-core/src/utils/read_complex_binary.m48
-rw-r--r--gnuradio-core/src/utils/read_float_binary.m45
-rw-r--r--gnuradio-core/src/utils/read_int_binary.m46
-rw-r--r--gnuradio-core/src/utils/read_short_binary.m45
-rw-r--r--gnuradio-core/src/utils/read_xambi.m46
-rw-r--r--gnuradio-core/src/utils/runsum.m9
-rw-r--r--gnuradio-core/src/utils/single_pole_iir.m25
-rw-r--r--gnuradio-core/src/utils/write_float_binary.m40
-rw-r--r--gnuradio-core/src/utils/write_short_binary.m40
29 files changed, 1206 insertions, 0 deletions
diff --git a/gnuradio-core/src/utils/Makefile.am b/gnuradio-core/src/utils/Makefile.am
new file mode 100644
index 0000000000..ee0bd437bf
--- /dev/null
+++ b/gnuradio-core/src/utils/Makefile.am
@@ -0,0 +1,43 @@
+#
+# Copyright 2001 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+
+include $(top_srcdir)/Makefile.common
+
+EXTRA_DIST = \
+ db_width.m \
+ filter_tools.m \
+ plot_freq_response.m \
+ plot_freq_response_db.m \
+ plot_freq_response_phase.m \
+ plotfft.m \
+ plotfftavgk.m \
+ plotfftavgk_db.m \
+ plotfftk.m \
+ plotfftk_db.m \
+ put_markers.m \
+ read_char_binary.m \
+ read_complex_binary.m \
+ read_float_binary.m \
+ read_int_binary.m \
+ read_short_binary.m \
+ single_pole_iir.m \
+ write_float_binary.m \
+ write_short_binary.m
diff --git a/gnuradio-core/src/utils/cool.m b/gnuradio-core/src/utils/cool.m
new file mode 100644
index 0000000000..eff194d877
--- /dev/null
+++ b/gnuradio-core/src/utils/cool.m
@@ -0,0 +1,50 @@
+%% Copyright (C) 1999,2000 Kai Habel
+%%
+%% This program is free software; you can redistribute it and/or modify
+%% it under the terms of the GNU General Public License as published by
+%% the Free Software Foundation; either version 2 of the License, or
+%% (at your option) any later version.
+%%
+%% This program is distributed in the hope that it will be useful,
+%% but WITHOUT ANY WARRANTY; without even the implied warranty of
+%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+%% GNU General Public License for more details.
+%%
+%% You should have received a copy of the GNU General Public License
+%% along with this program; if not, write to the Free Software
+%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+%% -*- texinfo -*-
+%% @deftypefn {Function File} {} cool (@var{n})
+%% Create color colormap.
+%% (cyan to magenta)
+%% The argument @var{n} should be a scalar. If it
+%% is omitted, the length of the current colormap or 64 is assumed.
+%% @end deftypefn
+%% @seealso{colormap}
+
+%% Author: Kai Habel <kai.habel@gmx.de>
+
+function map = cool (number)
+
+ if (nargin == 0)
+ number = rows (colormap);
+ elseif (nargin == 1)
+ if (! is_scalar (number))
+ error ("cool: argument must be a scalar");
+ end
+ else
+ usage ("cool (number)");
+ end
+
+ if (number == 1)
+ map = [0, 1, 1];
+ elseif (number > 1)
+ r = (0:number - 1)' ./ (number - 1);
+ g = 1 - r;
+ b = ones (number, 1);
+ map = [r, g, b];
+ else
+ map = [];
+ end
+
diff --git a/gnuradio-core/src/utils/db_width.m b/gnuradio-core/src/utils/db_width.m
new file mode 100644
index 0000000000..c12dfd1ccc
--- /dev/null
+++ b/gnuradio-core/src/utils/db_width.m
@@ -0,0 +1,35 @@
+%
+% Copyright 2001 Free Software Foundation, Inc.
+%
+% This file is part of GNU Radio
+%
+% GNU Radio is free software; you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation; either version 2, or (at your option)
+% any later version.
+%
+% GNU Radio is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with GNU Radio; see the file COPYING. If not, write to
+% the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+% Boston, MA 02111-1307, USA.
+
+%% find the N-dB width of the given filter
+%% E.g., to find the 3-dB width, use width = db_width (taps, -3.0)
+%% the result is normalized to nyquist == 1
+
+function width = db_width (taps, db)
+ [H,w] = freqz (taps, 1, 4096);
+ Habs = abs(H);
+ max_H = max(Habs);
+ min_H = min(Habs);
+ threshold = max_H * 10^(db/20);
+ if (min_H > threshold)
+ error ("The %g dB point is never reached", db);
+ end
+ above = Habs >= threshold;
+ width = sum(above) / length (above);
diff --git a/gnuradio-core/src/utils/filter_tools.m b/gnuradio-core/src/utils/filter_tools.m
new file mode 100644
index 0000000000..78a50b7d87
--- /dev/null
+++ b/gnuradio-core/src/utils/filter_tools.m
@@ -0,0 +1,42 @@
+%
+% Copyright 2001 Free Software Foundation, Inc.
+%
+% This file is part of GNU Radio
+%
+% GNU Radio is free software; you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation; either version 2, or (at your option)
+% any later version.
+%
+% GNU Radio is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with GNU Radio; see the file COPYING. If not, write to
+% the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+% Boston, MA 02111-1307, USA.
+%
+%% equivalent to the C++ code in VrComplexFIRfilter::buildFilterComplex
+
+1;
+
+%% hamming window, nothing fancy
+
+function taps = build_filter_complex_lp (gain, ntaps)
+
+ taps = gain * (0.54 - 0.46 * cos (2 * pi * (0:ntaps-1)' / (ntaps-1)));
+
+end
+
+%% old_taps describes a low pass filter, convert it to bandpass
+%% centered at center_freq. center_freq is normalized to Fs (sampling freq)
+
+function new_taps = freq_shift_filter (old_taps, center_freq)
+
+ ntaps = length(old_taps);
+
+ new_taps = exp (j*2*pi*center_freq*(0:ntaps-1)') .* old_taps;
+
+end
diff --git a/gnuradio-core/src/utils/is_complex.m b/gnuradio-core/src/utils/is_complex.m
new file mode 100644
index 0000000000..a17b8ad418
--- /dev/null
+++ b/gnuradio-core/src/utils/is_complex.m
@@ -0,0 +1,24 @@
+#
+# Copyright 2004 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+
+function p = is_complex (x)
+ p = any (imag (x) != 0);
+endfunction;
diff --git a/gnuradio-core/src/utils/lp_to_bp.m b/gnuradio-core/src/utils/lp_to_bp.m
new file mode 100644
index 0000000000..8718baed20
--- /dev/null
+++ b/gnuradio-core/src/utils/lp_to_bp.m
@@ -0,0 +1,27 @@
+#
+# Copyright 2002 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+
+## transform low pass coefficients into bandpass coefficients
+
+function bp_taps = lp_to_bp (lp_taps, center_freq, sampling_freq)
+ arg = 2 * pi * center_freq / sampling_freq;
+ bp_taps = lp_taps .* exp (j*arg*(0:length(lp_taps)-1)');
+endfunction
diff --git a/gnuradio-core/src/utils/partition-cascaded-decimating-filters.scm b/gnuradio-core/src/utils/partition-cascaded-decimating-filters.scm
new file mode 100644
index 0000000000..598f79d8c3
--- /dev/null
+++ b/gnuradio-core/src/utils/partition-cascaded-decimating-filters.scm
@@ -0,0 +1,68 @@
+;; Estimate the total work (ntaps * sampling rate) for two cascaded
+;; decimating low pass filters.
+;;
+;; The basic assumption is that the number of taps required in any
+;; section is inversely proportional to the normalized transition width
+;; for that section.
+;;
+;; FS is the input sampling frequency
+;; F1 is the cutoff frequency
+;; F2 is the far edge of the transition band
+;; DEC1 is the decimation factor for the first filter
+;; DEC2 is the decimation factor for the 2nd filter
+;;
+;; The total decimation factor is DEC1 * DEC2. Therefore,
+;; the output rate of the filter is FS / (DEC1 * DEC2)
+
+(require 'common-list-functions)
+(require 'factor)
+
+
+
+(define (work2 fs f1 f2 dec1 dec2)
+ (+ (work1 fs f1 (/ fs (* 2 dec1)) dec1)
+ (work1 (/ fs dec1) f1 f2 dec2)))
+
+
+;; work for a single section
+
+(define (work1 fs f1 f2 dec)
+ (/ (* fs (/ fs (- f2 f1))) dec))
+
+
+;; return the max integer dec such that fs/(2*dec) >= f2
+
+(define (max-dec fs f2)
+ (inexact->exact (floor (/ fs (* 2 f2)))))
+
+
+;; `adjoin' returns the adjoint of the element OBJ and the list LST.
+;; That is, if OBJ is in LST, `adjoin' returns LST, otherwise, it returns
+;; `(cons OBJ LST)'.
+
+(define (adjoin-equal obj lst)
+ (if (member obj lst) lst (cons obj lst)))
+
+
+;;; not quite right
+
+(define (permute lst)
+ (let ((result '()))
+ (define (aux set head)
+ (if (null? set)
+ (set! result (cons head result))
+ (for-each (lambda (x)
+ (aux (set-difference set (list x))
+ (cons x head)))
+ set)))
+ (aux lst '())
+ result))
+
+;; `extract-nth' returns the Nth element of LST consed on to the
+;; list resulting from splicing out the Nth element of LST.
+;; Indexing is 0 based.
+
+(define (extract-nth n lst)
+ lst)
+
+ \ No newline at end of file
diff --git a/gnuradio-core/src/utils/permute.scm b/gnuradio-core/src/utils/permute.scm
new file mode 100644
index 0000000000..23ddfc9991
--- /dev/null
+++ b/gnuradio-core/src/utils/permute.scm
@@ -0,0 +1,27 @@
+(require 'common-list-functions)
+
+
+(define (permute lst)
+ (define (aux set head)
+ (cond ((null? set) head)
+ (else
+ (map (lambda (x)
+ (aux (set-difference set (list x))
+ (cons x head)))
+ set))))
+ (aux lst '()))
+
+(define (permute-2 lst)
+ (let ((result '()))
+ (define (aux set head)
+ (if (null? set)
+ (set! result (cons head result))
+ (for-each (lambda (x)
+ (aux (set-difference set (list x))
+ (cons x head)))
+ set)))
+ (aux lst '())
+ result))
+
+
+
diff --git a/gnuradio-core/src/utils/plot_cic_decimator_response.m b/gnuradio-core/src/utils/plot_cic_decimator_response.m
new file mode 100644
index 0000000000..e26883c5ca
--- /dev/null
+++ b/gnuradio-core/src/utils/plot_cic_decimator_response.m
@@ -0,0 +1,45 @@
+#
+# Copyright 2004 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+
+function plot_cic_decimator_response (R, N, M)
+ ## R = decimation rate
+ ## N = number of stages (4)
+ ## M = 1
+ gain = (R*M)^N
+ npoints = 1024;
+ w = 0:1/npoints:1-1/npoints;
+ w = w * 1 * pi;
+ ## w = w * R;
+ length(w);
+ num = sin (w*R*M/2);
+ length (num);
+ ## H = sin (w*R*M/2) ./ sin (w/2)
+ denom = sin(w/2);
+ length (denom);
+ H = (num ./ denom) .^ N;
+ H(1) = gain;
+ H = H ./ gain;
+ plot (R*w/(2*pi), 10 * log10 (H));
+ ## plot (R*w/(2*pi), H);
+endfunction
+
+
+ \ No newline at end of file
diff --git a/gnuradio-core/src/utils/plot_freq_response.m b/gnuradio-core/src/utils/plot_freq_response.m
new file mode 100644
index 0000000000..bf186fae3f
--- /dev/null
+++ b/gnuradio-core/src/utils/plot_freq_response.m
@@ -0,0 +1,36 @@
+#
+# Copyright 2001 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+
+function plot_freq_response (b,...)
+ if (nargin == 1)
+ ## Response of an FIR filter
+ a = 1;
+ elseif (nargin == 2)
+ ## response of an IIR filter
+ a = va_arg ();
+ endif
+
+ [H,w] = freqz (b,a);
+ plot (w/(2*pi), abs(H));
+ grid;
+ xlabel ('Normalized Frequency (Fs == 1)');
+ ylabel ('Magnitude (linear)');
+endfunction
diff --git a/gnuradio-core/src/utils/plot_freq_response_db.m b/gnuradio-core/src/utils/plot_freq_response_db.m
new file mode 100644
index 0000000000..d6ebce39ae
--- /dev/null
+++ b/gnuradio-core/src/utils/plot_freq_response_db.m
@@ -0,0 +1,39 @@
+#
+# Copyright 2001 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+
+function plot_freq_response_db (b,...)
+ if (nargin == 1)
+ ## Response of an FIR filter
+ a = 1;
+ elseif (nargin == 2)
+ ## response of an IIR filter
+ a = va_arg ();
+ endif
+
+ [H,w] = freqz (b,a);
+
+ grid;
+ xlabel ('Normalized Frequency (Fs == 1)');
+ ylabel ('Magnitude Squared (dB)');
+ abs = abs(H);
+# plot (w/(2*pi), 20 * log10 (abs/max(abs)));
+ plot (w/(2*pi), 20 * log10 (abs));
+endfunction
diff --git a/gnuradio-core/src/utils/plot_freq_response_phase.m b/gnuradio-core/src/utils/plot_freq_response_phase.m
new file mode 100644
index 0000000000..f30ff7d3dc
--- /dev/null
+++ b/gnuradio-core/src/utils/plot_freq_response_phase.m
@@ -0,0 +1,38 @@
+#
+# Copyright 2001 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+
+function plot_freq_response_db (b,...)
+ if (nargin == 1)
+ ## Response of an FIR filter
+ a = 1;
+ elseif (nargin == 2)
+ ## response of an IIR filter
+ a = va_arg ();
+ endif
+
+ [H,w] = freqz (b,a);
+
+ grid;
+ xlabel ('Normalized Frequency (Fs == 1)');
+ ylabel ('Phase (radians)');
+ abs = abs(H);
+ plot (w/(2*pi), atan2(imag(H), real(H)))
+endfunction
diff --git a/gnuradio-core/src/utils/plotfft.m b/gnuradio-core/src/utils/plotfft.m
new file mode 100644
index 0000000000..5af149a145
--- /dev/null
+++ b/gnuradio-core/src/utils/plotfft.m
@@ -0,0 +1,40 @@
+#
+# Copyright 2001 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+
+function plotfft (data, sample_rate)
+
+ if (nargin == 1)
+ sample_rate = 1.0;
+ endif;
+
+ if ((m = nargchk (1,2,nargin)))
+ usage (m);
+ endif;
+
+ len = length(data);
+ s = fft (data.*kaiser(len, 5));
+
+ incr = sample_rate/len;
+ min_x = -sample_rate/2;
+ max_x = sample_rate/2 - incr;
+ plot (min_x:incr:max_x, abs(fftshift(s)));
+
+endfunction
diff --git a/gnuradio-core/src/utils/plotfftavgk.m b/gnuradio-core/src/utils/plotfftavgk.m
new file mode 100644
index 0000000000..3e19f40cef
--- /dev/null
+++ b/gnuradio-core/src/utils/plotfftavgk.m
@@ -0,0 +1,61 @@
+#
+# Copyright 2002 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+
+function plotfftavgk_db (all_data, k, sample_rate)
+
+ if (nargin == 2)
+ sample_rate = 1.0;
+ endif;
+
+ if ((m = nargchk (2,3,nargin)))
+ usage (m);
+ endif;
+
+ ## len = 1024;
+ len = 8192;
+ ##window = ones (len, 1);
+ window = kaiser (len, 5);
+
+ s = zeros (len,1);
+
+ count = min (100, floor (length (all_data)/len));
+
+ for i = 0:count-1;
+ data = all_data((k+i)*len + 1 : (k+i+1)*len);
+ s = s + abs (fft (data.*window));
+ endfor;
+
+ s = s ./ count;
+
+ incr = sample_rate/len;
+ min_x = -sample_rate/2;
+ max_x = sample_rate/2 - incr;
+
+ x = min_x:incr:max_x;
+ ## y = 20 * log10(fftshift(s));
+ y = (fftshift(s));
+ plot (x, y);
+
+ i = find (y == max(y))
+ x(i)
+ y(i)
+
+endfunction
diff --git a/gnuradio-core/src/utils/plotfftavgk_db.m b/gnuradio-core/src/utils/plotfftavgk_db.m
new file mode 100644
index 0000000000..6dbb0f5027
--- /dev/null
+++ b/gnuradio-core/src/utils/plotfftavgk_db.m
@@ -0,0 +1,73 @@
+#
+# Copyright 2001 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+
+function plotfftavgk_db (all_data, k, sample_rate)
+
+ if (nargin == 2)
+ sample_rate = 1.0;
+ endif;
+
+ if ((m = nargchk (2,3,nargin)))
+ usage (m);
+ endif;
+
+ len = 1024;
+ ## len = 8192;
+ ##window = ones (len, 1);
+ #window = kaiser (len, 5);
+ window = hanning (len);
+
+ s = zeros (len,1);
+
+ count = min (100, floor (length (all_data)/len));
+
+ for i = 0:count-1;
+ data = all_data((k+i)*len + 1 : (k+i+1)*len);
+ s = s + abs (fft (data.*window));
+ endfor;
+
+ s = s ./ count;
+
+ incr = sample_rate/len;
+
+ if is_complex (all_data);
+ min_x = -sample_rate/2;
+ max_x = sample_rate/2 - incr;
+
+ x = min_x:incr:max_x;
+ y = 20 * log10(fftshift(s));
+ plot (x, y);
+ else
+ min_x = 0
+ max_x = sample_rate/2 - incr;
+
+ x = min_x:incr:max_x;
+ y = 20 * log10(s(1:len/2));
+ plot (x, y);
+
+ endif;
+
+
+ i = find (y == max(y))
+ x(i)
+ y(i)
+
+endfunction
diff --git a/gnuradio-core/src/utils/plotfftk.m b/gnuradio-core/src/utils/plotfftk.m
new file mode 100644
index 0000000000..bf93ea5d52
--- /dev/null
+++ b/gnuradio-core/src/utils/plotfftk.m
@@ -0,0 +1,41 @@
+#
+# Copyright 2001 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+
+function plotfftk (all_data, k, sample_rate)
+
+ if (nargin == 2)
+ sample_rate = 1.0;
+ endif;
+
+ if ((m = nargchk (2,3,nargin)))
+ usage (m);
+ endif;
+
+ len = 1024;
+ data = all_data(k*len + 1 : (k+1)*len);
+ s = fft (data.*kaiser(len, 5));
+
+ incr = sample_rate/len;
+ min_x = -sample_rate/2;
+ max_x = sample_rate/2 - incr;
+ plot (min_x:incr:max_x, abs(fftshift(s)));
+
+endfunction
diff --git a/gnuradio-core/src/utils/plotfftk_db.m b/gnuradio-core/src/utils/plotfftk_db.m
new file mode 100644
index 0000000000..498c22fccb
--- /dev/null
+++ b/gnuradio-core/src/utils/plotfftk_db.m
@@ -0,0 +1,43 @@
+#
+# Copyright 2001 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+
+function plotfftk_db (all_data, k, sample_rate)
+
+ if (nargin == 2)
+ sample_rate = 1.0;
+ endif;
+
+ if ((m = nargchk (2,3,nargin)))
+ usage (m);
+ endif;
+
+ len = 1024;
+ data = all_data(k*len + 1 : (k+1)*len);
+ ## s = fft (data.*kaiser(len, 5));
+ ## s = fft (data.*hamming(len));
+ s = fft (data.*hanning(len));
+
+ incr = sample_rate/len;
+ min_x = -sample_rate/2;
+ max_x = sample_rate/2 - incr;
+ plot (min_x:incr:max_x, 20 * log10(abs(fftshift(s))));
+
+endfunction
diff --git a/gnuradio-core/src/utils/put_markers.m b/gnuradio-core/src/utils/put_markers.m
new file mode 100644
index 0000000000..e35aee9d67
--- /dev/null
+++ b/gnuradio-core/src/utils/put_markers.m
@@ -0,0 +1,32 @@
+#
+# Copyright 2002 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+
+function put_markers (y)
+
+ if (nargin == 0)
+ y = 25;
+ endif;
+
+ hold on;
+ plot (3.06e6, y, '@');
+ plot (8.44e6, y, '@');
+
+endfunction
diff --git a/gnuradio-core/src/utils/rainbow.m b/gnuradio-core/src/utils/rainbow.m
new file mode 100644
index 0000000000..e19bd6797d
--- /dev/null
+++ b/gnuradio-core/src/utils/rainbow.m
@@ -0,0 +1,53 @@
+## Copyright (C) 1999,2000 Kai Habel
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} rainbow (@var{n})
+## Create color colormap.
+## (red through yellow, green, cyan,blue,magenta to red)
+## The argument @var{n} should be a scalar. If it
+## is omitted, the length of the current colormap or 64 is assumed.
+## @end deftypefn
+## @seealso{colormap}
+
+## Author: Kai Habel <kai.habel@gmx.de>
+
+## 2001-09-13 Paul Kienzle <pkienzle@users.sf.net>
+## * renamed to rainbow for use with tk_octave
+## * remove reference to __current_color_map__
+
+function map = rainbow (number)
+
+ if (nargin == 0)
+ number = length(colormap);
+ elseif (nargin == 1)
+ if (! is_scalar (number))
+ error ("rainbow: argument must be a scalar");
+ endif
+ else
+ usage ("rainbow (number)");
+ endif
+
+ if (number == 1)
+ map = [1, 0, 0];
+ elseif (number > 1)
+ h = linspace (0, 1, number)';
+ map = hsv2rgb ([h, ones(number, 1), ones(number, 1)]);
+ else
+ map = [];
+ endif
+
+endfunction
diff --git a/gnuradio-core/src/utils/read_char_binary.m b/gnuradio-core/src/utils/read_char_binary.m
new file mode 100644
index 0000000000..d33bd91a6f
--- /dev/null
+++ b/gnuradio-core/src/utils/read_char_binary.m
@@ -0,0 +1,45 @@
+%
+% Copyright 2001 Free Software Foundation, Inc.
+%
+% This file is part of GNU Radio
+%
+% GNU Radio is free software; you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation; either version 2, or (at your option)
+% any later version.
+%
+% GNU Radio is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with GNU Radio; see the file COPYING. If not, write to
+% the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+% Boston, MA 02111-1307, USA.
+%
+
+function v = read_char_binary (filename, count)
+
+ %% usage: read_char (filename, [count])
+ %%
+ %% open filename and return the contents, treating them as
+ %% signed short integers
+ %%
+
+ m = nargchk (1,2,nargin);
+ if (m)
+ usage (m);
+ end
+
+ if (nargin < 2)
+ count = Inf;
+ end
+
+ f = fopen (filename, 'rb');
+ if (f < 0)
+ v = 0;
+ else
+ v = fread (f, count, 'char');
+ fclose (f);
+ end
diff --git a/gnuradio-core/src/utils/read_complex_binary.m b/gnuradio-core/src/utils/read_complex_binary.m
new file mode 100644
index 0000000000..6f538f374a
--- /dev/null
+++ b/gnuradio-core/src/utils/read_complex_binary.m
@@ -0,0 +1,48 @@
+%
+% Copyright 2001 Free Software Foundation, Inc.
+%
+% This file is part of GNU Radio
+%
+% GNU Radio is free software; you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation; either version 2, or (at your option)
+% any later version.
+%
+% GNU Radio is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with GNU Radio; see the file COPYING. If not, write to
+% the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+% Boston, MA 02111-1307, USA.
+%
+
+function v = read_complex_binary (filename, count)
+
+ %% usage: read_complex_binary (filename, [count])
+ %%
+ %% open filename and return the contents as a column vector,
+ %% treating them as 32 bit complex numbers
+ %%
+
+ m = nargchk (1,2,nargin);
+ if (m)
+ usage (m);
+ end
+
+ if (nargin < 2)
+ count = Inf;
+ end
+
+ f = fopen (filename, 'rb');
+ if (f < 0)
+ v = 0;
+ else
+ t = fread (f, [2, count], 'float');
+ fclose (f);
+ v = t(1,:) + t(2,:)*i;
+ [r, c] = size (v);
+ v = reshape (v, c, r);
+ end
diff --git a/gnuradio-core/src/utils/read_float_binary.m b/gnuradio-core/src/utils/read_float_binary.m
new file mode 100644
index 0000000000..ac8461ff3e
--- /dev/null
+++ b/gnuradio-core/src/utils/read_float_binary.m
@@ -0,0 +1,45 @@
+%
+% Copyright 2001 Free Software Foundation, Inc.
+%
+% This file is part of GNU Radio
+%
+% GNU Radio is free software; you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation; either version 2, or (at your option)
+% any later version.
+%
+% GNU Radio is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with GNU Radio; see the file COPYING. If not, write to
+% the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+% Boston, MA 02111-1307, USA.
+%
+
+function v = read_float_binary (filename, count)
+
+ %% usage: read_float_binary (filename, [count])
+ %%
+ %% open filename and return the contents, treating them as
+ %% 32 bit floats
+ %%
+
+ m = nargchk (1,2,nargin);
+ if (m)
+ usage (m);
+ end
+
+ if (nargin < 2)
+ count = Inf;
+ end
+
+ f = fopen (filename, 'rb');
+ if (f < 0)
+ v = 0;
+ else
+ v = fread (f, count, 'float');
+ fclose (f);
+ end
diff --git a/gnuradio-core/src/utils/read_int_binary.m b/gnuradio-core/src/utils/read_int_binary.m
new file mode 100644
index 0000000000..ca4f733957
--- /dev/null
+++ b/gnuradio-core/src/utils/read_int_binary.m
@@ -0,0 +1,46 @@
+%
+% Copyright 2001,2002 Free Software Foundation, Inc.
+%
+% This file is part of GNU Radio
+%
+% GNU Radio is free software; you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation; either version 2, or (at your option)
+% any later version.
+%
+% GNU Radio is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with GNU Radio; see the file COPYING. If not, write to
+% the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+% Boston, MA 02111-1307, USA.
+%
+
+function v = read_int_binary (filename, count)
+
+ %% usage: read_int_binary (filename, [count])
+ %%
+ %% open filename and return the contents, treating them as
+ %% signed integers
+ %%
+
+ m = nargchk (1,2,nargin);
+ if (m)
+ usage (m);
+ end
+
+ if (nargin < 2)
+ count = Inf;
+ end
+
+ f = fopen (filename, 'rb');
+ if (f < 0)
+ v = 0;
+ else
+ v = fread (f, count, 'int');
+ fclose (f);
+ end
+end
diff --git a/gnuradio-core/src/utils/read_short_binary.m b/gnuradio-core/src/utils/read_short_binary.m
new file mode 100644
index 0000000000..361392bf45
--- /dev/null
+++ b/gnuradio-core/src/utils/read_short_binary.m
@@ -0,0 +1,45 @@
+%
+% Copyright 2001 Free Software Foundation, Inc.
+%
+% This file is part of GNU Radio
+%
+% GNU Radio is free software; you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation; either version 2, or (at your option)
+% any later version.
+%
+% GNU Radio is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with GNU Radio; see the file COPYING. If not, write to
+% the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+% Boston, MA 02111-1307, USA.
+%
+
+function v = read_short_binary (filename, count)
+
+ %% usage: read_short_binary (filename, [count])
+ %%
+ %% open filename and return the contents, treating them as
+ %% signed short integers
+ %%
+
+ m = nargchk (1,2,nargin);
+ if (m)
+ usage (m);
+ end
+
+ if (nargin < 2)
+ count = Inf;
+ end
+
+ f = fopen (filename, 'rb');
+ if (f < 0)
+ v = 0;
+ else
+ v = fread (f, count, 'short');
+ fclose (f);
+ end
diff --git a/gnuradio-core/src/utils/read_xambi.m b/gnuradio-core/src/utils/read_xambi.m
new file mode 100644
index 0000000000..7533ddac1a
--- /dev/null
+++ b/gnuradio-core/src/utils/read_xambi.m
@@ -0,0 +1,46 @@
+#
+# Copyright 2001,2005 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+
+function v = read_xambi (filename)
+
+ ## usage: read_xambi (filename)
+ ##
+ ## read binary cross-ambiguity data from radar tools.
+ ## The file has an 8 float header, the first word of which specifies
+ ## the number of doppler bins.
+ ## returns a matrix
+
+ if ((m = nargchk (1,1,nargin)))
+ usage (m);
+ endif;
+
+ f = fopen (filename, "rb");
+ if (f < 0)
+ v = 0;
+ else
+ header = fread(f, 8, "float");
+ ndoppler_bins = header(1)
+ min_doppler = header(2)
+ max_doppler = header(3)
+ v = fread (f, [ndoppler_bins, Inf], "float");
+ fclose (f);
+ endif;
+endfunction;
diff --git a/gnuradio-core/src/utils/runsum.m b/gnuradio-core/src/utils/runsum.m
new file mode 100644
index 0000000000..0f530b0159
--- /dev/null
+++ b/gnuradio-core/src/utils/runsum.m
@@ -0,0 +1,9 @@
+function r = runsum(x)
+ len = length(x);
+ r = zeros (1, len);
+ r(1) = x(1);
+ for i = 2:len;
+ r(i) = r(i-1) + x(i);
+ endfor;
+endfunction;
+
diff --git a/gnuradio-core/src/utils/single_pole_iir.m b/gnuradio-core/src/utils/single_pole_iir.m
new file mode 100644
index 0000000000..13d6b4d580
--- /dev/null
+++ b/gnuradio-core/src/utils/single_pole_iir.m
@@ -0,0 +1,25 @@
+#
+# Copyright 2002 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+
+function [b, a] = single_pole_iir (alpha)
+ b = [alpha];
+ a = [1, alpha - 1];
+endfunction \ No newline at end of file
diff --git a/gnuradio-core/src/utils/write_float_binary.m b/gnuradio-core/src/utils/write_float_binary.m
new file mode 100644
index 0000000000..c0d2743638
--- /dev/null
+++ b/gnuradio-core/src/utils/write_float_binary.m
@@ -0,0 +1,40 @@
+#
+# Copyright 2001 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+
+function v = write_float_binary (data, filename)
+
+ ## usage: write_float_binary (data, filename)
+ ##
+ ## open filename and write data to it as 32 bit floats
+ ##
+
+ if ((m = nargchk (2,2,nargin)))
+ usage (m);
+ endif;
+
+ f = fopen (filename, "wb");
+ if (f < 0)
+ v = 0;
+ else
+ v = fwrite (f, data, "float");
+ fclose (f);
+ endif;
+endfunction;
diff --git a/gnuradio-core/src/utils/write_short_binary.m b/gnuradio-core/src/utils/write_short_binary.m
new file mode 100644
index 0000000000..ffe502e68c
--- /dev/null
+++ b/gnuradio-core/src/utils/write_short_binary.m
@@ -0,0 +1,40 @@
+#
+# Copyright 2001 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+
+function v = write_short_binary (data, filename)
+
+ ## usage: write_short_binary (data, filename)
+ ##
+ ## open filename and write data to it as 16 bit shorts
+ ##
+
+ if ((m = nargchk (2,2,nargin)))
+ usage (m);
+ endif;
+
+ f = fopen (filename, "wb");
+ if (f < 0)
+ v = 0;
+ else
+ v = fwrite (f, data, "short");
+ fclose (f);
+ endif;
+endfunction;