diff options
Diffstat (limited to 'macros/rectwin.sci')
-rw-r--r-- | macros/rectwin.sci | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/macros/rectwin.sci b/macros/rectwin.sci index c296d42..f8cc445 100644 --- a/macros/rectwin.sci +++ b/macros/rectwin.sci @@ -1,25 +1,34 @@ -function [y] = rectwin (m) +//function [y] = rectwin (m) //This function returns the filter coefficients of a rectangular window. //Calling Sequence //y = rectwin (m) -//Parameters +//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. +//This function returns the filter coefficients of a rectangular window of length m supplied as input, to the output vector y. //Examples //rectwin(3) //ans = -// 1. -// 1. -// 1. -rhs = argn(2) +// 1. +// 1. +// 1. -if(rhs~=1) -error("Wrong number of input arguments.") -end -y = callOctave("rectwin",m) +function w = rectwin (m) + + funcprot(0); + rhs= argn(2); + + if (rhs ~= 1) + error("Wrong Number of input arguments"); + end + + if (~ (isscalar (m) & (m == fix (m)) & (m > 0))) + error ("rectwin: M must be a positive integer"); + end + + w=ones(m,1); endfunction |