[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: buffer (signal)?
From: |
dbateman |
Subject: |
Re: buffer (signal)? |
Date: |
Thu, 10 Apr 2008 13:58:03 -0700 (PDT) |
The below also implements the p argument though is untested as I don't have a
machine to test with at the moment, It also doesn't implement the opts arg
or the additional output args. Basically just a good start to get the real
function written or something to get your script going
D.
function [y, z, opts] = buffer (x, n, p, opts)
if (nargin < 2 || nargin > 4)
print_usage ();
endif
if (nargin < 3)
p = 0;
endif
if (nargin < 4)
opts = zeros (1, p);
endif
if (nargin == 4)
error ("unimplemented");
endif
if (nargout > 1)
error ("unimplemented")
endif
x = x(:);
l = length (x);
m = ceil (l / n);
y = zeros (n, m);
y (1 : l) = x;
if (p < 0)
y (end + p + 1 : end, :) = [];
elseif (p > 0)
y = [zeros(p, m); y];
y (1 : p, 2 : end) = y (end - p + 1 : end, 1 : end -1);
endif
endfunction
--
View this message in context:
http://www.nabble.com/buffer-%28signal%29--tp16615296p16617803.html
Sent from the Octave - General mailing list archive at Nabble.com.