summaryrefslogtreecommitdiff
path: root/macros/barthannwin.sci
diff options
context:
space:
mode:
authorSunil Shetye2018-07-25 17:11:09 +0530
committerSunil Shetye2018-07-26 23:50:17 +0530
commit1251f70aa3442736ce6fd9c4fb7fbce412af5a52 (patch)
tree360311ffaf6151c5066439f481e8ac38cfd047b9 /macros/barthannwin.sci
parent9ca7882cee16ad48b18df989e8300c697010e55a (diff)
downloadFOSSEE-Signal-Processing-Toolbox-1251f70aa3442736ce6fd9c4fb7fbce412af5a52.tar.gz
FOSSEE-Signal-Processing-Toolbox-1251f70aa3442736ce6fd9c4fb7fbce412af5a52.tar.bz2
FOSSEE-Signal-Processing-Toolbox-1251f70aa3442736ce6fd9c4fb7fbce412af5a52.zip
code changes by Kartik Hegde during FOSSEE Fellowship 2018
Diffstat (limited to 'macros/barthannwin.sci')
-rw-r--r--macros/barthannwin.sci45
1 files changed, 21 insertions, 24 deletions
diff --git a/macros/barthannwin.sci b/macros/barthannwin.sci
index 7ba7017..d915893 100644
--- a/macros/barthannwin.sci
+++ b/macros/barthannwin.sci
@@ -1,28 +1,25 @@
-function y = barthannwin(m)
-//This function returns the filter coefficients of a modified Bartlett-Hann window.
-//Calling Sequence
-//y = barthannwin(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 modified Bartlett Hann window of length m supplied as input, to the output vector y.
-//Examples
-//barthannwin(4)
-//ans =
-// 0.
-// 0.73
-// 0.73
-// 0.
+function w = barthannwin (m)
-funcprot(0);
-rhs = argn(2)
-if(rhs~=1)
-error("Wrong number of input arguments.")
-end
+ funcprot(0);
+ rhs= argn(2);
-y = callOctave("barthannwin",m)
+ if (rhs ~= 1)
+ error("Wrong Number of input arguments");
+ end
-endfunction
+ if (~ (isscalar (m) & (m == fix (m)) & (m > 0)))
+ error ("barthannwin: M must be a positive integer");
+ end
+
+
+ if (m == 1)
+ w = 1;
+ else
+ N = m - 1;
+ n = 0:N;
+ w = 0.62 -0.48.*abs(n./(m-1) - 0.5)+0.38*cos(2.*%pi*(n./(m-1)-0.5));
+ w = w';
+ end
+
+endfunction