diff options
Diffstat (limited to 'macros/kaiser.sci')
-rw-r--r-- | macros/kaiser.sci | 51 |
1 files changed, 31 insertions, 20 deletions
diff --git a/macros/kaiser.sci b/macros/kaiser.sci index 2c33b3f..b36e931 100644 --- a/macros/kaiser.sci +++ b/macros/kaiser.sci @@ -1,33 +1,44 @@ -function w = kaiser (m, beta) +function w = kaiser (m, varargin) //This function returns the filter coefficients of a Kaiser window. + //Calling Sequence //w = kaiser (m) //w = kaiser (m, beta) -//Parameters + +//Parameters //m: positive integer value //beta: real scalar value -//w: output variable, vector of real numbers +//w: output variable, vector of real numbers + //Description //This is an Octave function. //This function returns the filter coefficients of a Kaiser window of length m supplied as input, to the output vector w. //The second parameter gives the stop band attenuation of the Fourier transform of the window on derivation. + //Examples //kaiser(6,0.2) -//ans = -// 0.9900745 -// 0.9964211 -// 0.9996020 -// 0.9996020 -// 0.9964211 -// 0.9900745 +// ans = +// +// 0.9900745 +// 0.9964211 +// 0.9996020 +// 0.9996020 +// 0.9964211 +// 0.9900745 + funcprot(0); -rhs = argn(2) -if(rhs<1 | rhs>2) -error("Wrong number of input arguments.") -end -if(rhs==1) -w = callOctave("kaiser", m) -elseif(rhs==2) -w = callOctave("kaiser", m, beta) -end -endfunction + rhs = argn(2) + if(rhs<1 | rhs>2) + error("Wrong number of input arguments.") + end + + if length(varargin)==0 then + bet = 0.5; //default value of beta is 0.5 + else + bet = varargin(1); + end + +w = window('kr', m, bet) //default value of beta is 0.5 +w = w' ; + +endfunction |