diff options
Diffstat (limited to 'macros/gausswin.sci')
-rw-r--r-- | macros/gausswin.sci | 55 |
1 files changed, 25 insertions, 30 deletions
diff --git a/macros/gausswin.sci b/macros/gausswin.sci index eb3b3d8..4a65c14 100644 --- a/macros/gausswin.sci +++ b/macros/gausswin.sci @@ -1,32 +1,27 @@ +// Copyright (C) 2018 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Author:[insert name] +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + + function w = gausswin (m, a) -//This function returns the filter coefficients of a Gaussian window. -//Calling Sequence -//w = gausswin (m) -//w = gausswin (m, a) -//Parameters -//m: positive integer value -//a: -//w: output variable, vector of real numbers -//Description -//This is an Octave function. -//This function returns the filter coefficients of a Gaussian window of length m supplied as input, to the output vector w. -//The second parameter is the width measured in sample rate/number of samples and should be f for time domain and 1/f for frequency domain. The width is inversely proportional to a. -//Examples -//gausswin(3) -//ans = -// 0.2493522 -// 1. -// 0.2493522 - -funcprot(0); -rhs = argn(2) -if(rhs<1 | rhs>2) -error("Wrong number of input arguments.") -end -if(rhs==1) -w = callOctave("gausswin",m) -elseif(rhs==2) -w = callOctave("gausswin",m,a) -end -endfunction +//This function is used to generate the gaussian window. +[nargout,nargin]=argn(); + if (nargin < 1 | nargin > 2) + error("wrong no. of input arguments"); + elseif (~ (isscalar (m) & (m == fix (m)) & (m > 0))) + error ("gausswin: M must be a positive integer"); + elseif (nargin == 1) + a = 2.5; + end + + w = exp ( -0.5 * ( a/m * [ -(m-1) : 2 : m-1 ]' ) .^ 2 ); + +endfunction |