diff options
Diffstat (limited to 'macros/boxcar.sci')
-rw-r--r-- | macros/boxcar.sci | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/macros/boxcar.sci b/macros/boxcar.sci index 120c6e9..e0aace6 100644 --- a/macros/boxcar.sci +++ b/macros/boxcar.sci @@ -1,28 +1,16 @@ -function [y] = boxcar (m) -//This function returns the filter coefficients of a rectangular window. -//Calling Sequence -//y = boxcar (m) -//Parameters -//m: positive integer value -//y: output variable, vector of real numbers -//Description -//This is an Octave function. -//This function returns the filter coefficients of a rectangular window of length m supplied as input, to the output vector y. -//Examples -//boxcar(6) -//ans = -// 1. -// 1. -// 1. -// 1. -// 1. -// 1. +function w = boxcar (m) -rhs = argn(2) -if(rhs~=1) -error("Wrong number of input arguments.") -end + funcprot(0); + rhs= argn(2); -y = callOctave("boxcar",m) + if (rhs ~= 1) + error("Wrong Number of input arguments"); + end + + if (~ (isscalar (m) & (m == fix (m)) & (m > 0))) + error ("boxcar: M must be a positive integer"); + end + + w=ones(m,1); endfunction |