summaryrefslogtreecommitdiff
path: root/macros
diff options
context:
space:
mode:
Diffstat (limited to 'macros')
-rw-r--r--macros/ac2poly.sci~29
-rw-r--r--macros/ac2rc.sci~47
-rw-r--r--macros/arburg.sci~55
-rw-r--r--macros/arcov.sci~33
-rw-r--r--macros/aryule.sci~38
-rw-r--r--macros/bitrevorder.sci~25
-rw-r--r--macros/buildmacros.sce~15
-rw-r--r--macros/callOct.sci~18
-rw-r--r--macros/cheby2.sci~58
-rw-r--r--macros/decimate.sci~48
-rw-r--r--macros/fwhmjlt.sci~18
-rw-r--r--macros/medfilt1.sci~346
-rw-r--r--macros/names~0
-rwxr-xr-xmacros/polyval.sci~69
-rw-r--r--macros/schurrc.sci~49
-rw-r--r--macros/taylorwin.sci~83
16 files changed, 0 insertions, 931 deletions
diff --git a/macros/ac2poly.sci~ b/macros/ac2poly.sci~
deleted file mode 100644
index 653ccce..0000000
--- a/macros/ac2poly.sci~
+++ /dev/null
@@ -1,29 +0,0 @@
-function [a,varargout] = ac2poly(r)
-// Convert autocorrelation sequence to polynomial of prediction filter
-//
-// Calling Sequence
-// a = ac2poly(r)
-// [a,e] = ac2poly(r)
-//
-// Parameters
-// r: Autocorrelation sequence to be represented with an FIR linear prediction filter
-// a: Output polynomial representing the linear prediction filter e/(a(1) + a(2)z + a(3)z^2 .. a(N)z^N-1)
-// e: Output scaling for the lienar prediction filter
-//
-// Description
-// Function ac2poly() finds the best fit polynomial for FIR linear prediction filter a, corresponding to the autocorrelation sequence r. a is the same length as r, and is normalized with the first element. So a(1) = 1.
-// Author:
-// Parthe Pandit
-//
-// Bibliography
-// Kay, Steven M. Modern Spectral Estimation. Englewood Cliffs, NJ: Prentice-Hall, 1988.
-
-//errcheck
-if (type(r) > 1) then
- error('Input autocorrelation sequence needs to be of type double');
-end
-
-[a,e] = levinson(r);
-varargout = list(e);
-
-endfunction
diff --git a/macros/ac2rc.sci~ b/macros/ac2rc.sci~
deleted file mode 100644
index bace840..0000000
--- a/macros/ac2rc.sci~
+++ /dev/null
@@ -1,47 +0,0 @@
-function [k,R0] = ac2rc(R)
-// Convert autocorrelation sequence to reflection coefficients.
-// Calling Sequence
-// k = ac2rc(R)
-// [k,R0] = ac2rc(R)
-// Parameters
-// R: The input autocorrelation sequence. If r is a matrix, each column of r is treated as a separate signal.
-// k: Returns the reflection coefficients
-// R0: the zero lag autocorrelation, R0, based on the autocorrelation sequence, R.
-// Examples
-// X = [7 6 5 8 3 6 8 7 5 2 4 7 4 3 2 5 4 9 5 3 5 7 3 9 4 1 2 0 5 4 8 6 4 6 5 3];
-// [k,R0] = ac2rc(X)
-// or t=[2 5 6; 8 6 5; 8 9 4]
-// [k,R0] = ac2rc(t)
-// Author
-// Jitendra Singh
-//
-
- // call function "levin" before running this function
-
-if or(type(R)==10) then
- error ('Input arguments must be double.')
-end
-
-if isvector(R) then
- R=R(:);
-
- [x,y,z] = levin(R)
-k=z;
-R0=R;
-
-else
- n=size(R);
-
- for i=1:n(2)
- r=R(:,i);
-
- [x,y, z] = levin(r)
-
- kk(:,i)= z;
-
-k=kk;
-R0=R(1,:);
- end
-
- end
-endfunction
diff --git a/macros/arburg.sci~ b/macros/arburg.sci~
deleted file mode 100644
index 1ca6e01..0000000
--- a/macros/arburg.sci~
+++ /dev/null
@@ -1,55 +0,0 @@
-function varargout = arburg( x, poles, criterion )
-//This function calculates coefficients of an autoregressive (AR) model of complex data.
-//Calling Sequence
-//a = arburg(x, poles)
-//a = arburg(x, poles, criterion)
-//[a, v] = arburg(...)
-//[a, v, k] = arburg(...)
-//Parameters
-//x: vector of real or complex numbers, of length > 2
-//poles: positive integer value < length(x) - 2
-//criterion: string value, takes in "AKICc", "KIC", "AICc", "AIC" and "FPE", default it not using a model-selection criterion
-//a, v, k: Output variables
-//Description
-//This is an Octave function.
-//This function calculates coefficients of an autoregressive (AR) model of complex data x using the whitening lattice-filter method of Burg.
-//The first argument is the data sampled. The second argument is the number of poles in the model (or limit in case a criterion is supplied).
-//The third parameter takes in the criterion to limit the number of poles. The acceptable values are "AIC", "AKICc", "KIC", "AICc" which are based on information theory.
-//Output variable a is a list of P+1 autoregression coefficients.
-//Output variable v is the mean square of residual noise from the whitening operation of the Burg lattice filter.
-//Output variable k corresponds to the reflection coefficients defining the lattice-filter embodiment of the model.
-//Examples
-//arburg([1,2,3,4,5],2)
-//ans =
-// 1.00000 -1.86391 0.95710
-
-funcprot(0);
-rhs = argn(2)
-lhs = argn(1)
-if(lhs>3)
-error("Wrong number of output arguments.")
-elseif(rhs<2)
-error("Wrong number of input arguments.")
-end
-
- select(lhs)
- case 1 then
- if(rhs==2)
- a = callOctave("arburg",x,poles)
- elseif(rhs==3)
- a = callOctave("arburg",x,poles,criterion)
- end
- case 2 then
- if(rhs==2)
- [a,v] = callOctave("arburg",x,poles)
- elseif(rhs==3)
- [a,v] = callOctave("arburg",x,poles,criterion)
- end
- case 3 then
- if(rhs==2)
- [a,v,k] = callOctave("arburg",x,poles)
- elseif(rhs==3)
- [a,v,k] = callOctave("arburg",x,poles,criterion)
- end
- end
-endfunction
diff --git a/macros/arcov.sci~ b/macros/arcov.sci~
deleted file mode 100644
index 179e34a..0000000
--- a/macros/arcov.sci~
+++ /dev/null
@@ -1,33 +0,0 @@
-function [ar_coeff, var_est] = arcov(data_in, order)
-//arcov Autoregressive all-pole model parameters — covariance method
-//Calling Syntax
-//a = arcov(x,p)
-//[a,e] = arcov(x,p)
-//a, contains normalized estimates of the AR system parameters, A(z), in descending powers of z.
-//e variance estimate of the white noise input to the AR model
-// x is the input signal
-// p is the order of the auto regressive model
-
- checkNArgin(2,2, argn(2));
- if type(data_in)==10 then
- error("Input should not be of type char");
- end
- method = 'covariance';
- [ar_coeff, var_est, msg] = arParEst(data_in, order, method);
- if ~isempty(msg) then
- error(msg);
- end
-
-
-endfunction
-
-function checkNArgin(min_argin, max_argin, num_of_argin)
- if num_of_argin < min_argin then
- error('Not enough input arguments')
- end
-
- if num_of_argin > max_argin then
- error('Too many input arguments')
- end
-
-endfunction
diff --git a/macros/aryule.sci~ b/macros/aryule.sci~
deleted file mode 100644
index c933340..0000000
--- a/macros/aryule.sci~
+++ /dev/null
@@ -1,38 +0,0 @@
-function [a, v, k] = aryule (x, p)
-//This function fits an AR (p)-model with Yule-Walker estimates.
-//Calling Sequence
-//a = aryule (x, p)
-//[a, v] = aryule (x, p)
-//[a, v, k] = aryule (x, p)
-//Parameters
-//x: vector of real or complex numbers, length > 2
-//p: positive integer value < length(x) - 1
-//a, v, k: Output variables
-//Description
-//This is an Octave function.
-//This function fits an AR (p)-model with Yule-Walker estimates.
-//The first argument is the data vector which is to be estimated.
-//Output variable a gives the AR coefficients, v gives the variance of the white noise and k gives the reflection coefficients to be used in the lattice filter.
-//Examples
-//aryule([1,2,3,4,5],2)
-//ans =
-// 1. - 0.8140351 0.1192982
-
-funcprot(0);
-rhs = argn(2)
-lhs = argn(1)
-
-if(rhs~=2)
-error("Wrong number of input arguments.")
-end
-
- select(lhs)
- case 1 then
- a = callOctave("aryule",x,p)
- case 2 then
- [a,v] = callOctave("aryule",x,p)
- case 3 then
- [a,v,k] = callOctave("aryule",x,p)
- end
-
-endfunction
diff --git a/macros/bitrevorder.sci~ b/macros/bitrevorder.sci~
deleted file mode 100644
index 86f6a35..0000000
--- a/macros/bitrevorder.sci~
+++ /dev/null
@@ -1,25 +0,0 @@
-function [y,i]=bitrevorder(x)
-
-// Returns input data in bit-reversed order
-// Calling Sequence
-// [y,i]=bitrevorder(x)
-// Parameters
-// x: Vector of real or complex values
-// Description
-// This is an Octave function.
-// This function returns the input data after reversing the bits of the indices and reordering the elements of the input array.
-// Examples
-// 1. [y]=bitrevorder ([i,1,3,6i])
-// y = [0 + 1i 3 + 0i 1 + 0i 0 + 6i]
-// 2. [y,i]=bitrevorder (['a','b','c','d'])
-// y = acbd
-// i = [1 3 2 4]
-
-funcprot(0);
-[lhs,rhs]=argn(0);
-if (rhs<1) then
- error ("Wrong number of input arguments.")
-end
-[y,i]=callOctave("bitrevorder",x)
-end
-endfunction
diff --git a/macros/buildmacros.sce~ b/macros/buildmacros.sce~
deleted file mode 100644
index 3580198..0000000
--- a/macros/buildmacros.sce~
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright (C) 2017 - IIT Bombay - FOSSEE
-//
-// This file must be used under the terms of the BSD.
-// This source file is licensed as described in the file LICENSE, which
-// you should have received as part of this distribution. The terms
-// are also available at
-// https://opensource.org/licenses/BSD-3-Clause
-// Author: Shamika Mohanan
-// Organization: FOSSEE, IIT Bombay
-// Email: toolbox@scilab.in
-
-tbx_build_macros("FOSSEE_Scilab_Octave_Interface_Toolbox", get_absolute_file_path("buildmacros.sce"));
-
-clear tbx_build_macros;
-
diff --git a/macros/callOct.sci~ b/macros/callOct.sci~
deleted file mode 100644
index a9061e1..0000000
--- a/macros/callOct.sci~
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright (C) 2017 - IIT Bombay - FOSSEE
-//
-// This file must be used under the terms of the BSD.
-// This source file is licensed as described in the file LICENSE, which
-// you should have received as part of this distribution. The terms
-// are also available at
-// https://opensource.org/licenses/BSD-3-Clause
-// Author: Shamika Mohanan
-// Organization: FOSSEE, IIT Bombay
-// Email: toolbox@scilab.in
-
-
-
-function a=callOct(fname,varargin)
-
- a=callOctave(fname,varargin);
-
-endfunction
diff --git a/macros/cheby2.sci~ b/macros/cheby2.sci~
deleted file mode 100644
index 9efd721..0000000
--- a/macros/cheby2.sci~
+++ /dev/null
@@ -1,58 +0,0 @@
-function [a, b, c, d] = cheby2 (n, rs, w, varargin)
-//This function generates a Chebyshev type II filter with rs dB of stopband attenuation.
-//Calling Sequence
-//[a, b] = cheby2 (n, rs, wc)
-//[a, b] = cheby2 (n, rs, wc, "high")
-//[a, b] = cheby2 (n, rs, [wl, wh])
-//[a, b] = cheby2 (n, rs, [wl, wh], "stop")
-//[a, b, c] = cheby2 (…)
-//[a, b, c, d] = cheby2 (…)
-//[…] = cheby2 (…, "s")
-//Parameters
-//n: positive integer value
-//rp: non negative scalar value
-//w: vector, all elements must be in the range [0,1]
-//Description
-//This is an Octave function.
-//This function generates a Chebyshev type II filter with rs dB of stopband attenuation.
-//The fourth parameter takes in high or low, default value is low. The cutoff is pi*Wc radians.
-//[b, a] = cheby2(n, Rp, [Wl, Wh]) indicates a band pass filter with edges pi*Wl and pi*Wh radians.
-//[b, a] = cheby2(n, Rp, [Wl, Wh], ’stop’) indicates a band reject filter with edges pi*Wl and pi*Wh radians.
-//[z, p, g] = cheby2(...) returns filter as zero-pole-gain rather than coefficients of the numerator and denominator polynomials.
-//[...] = cheby2(...,’s’) returns a Laplace space filter, w can be larger than 1.
-//[a,b,c,d] = cheby2(...) returns state-space matrices.
-//Examples
-//[a,b,c]=cheby2(2,5,0.7,"high")
-//a =
-// -0.31645 - 0.94861i -0.31645 + 0.94861i
-//b =
-// -0.39388 + 0.53138i -0.39388 - 0.53138i
-//c = 0.47528
-
-rhs = argn(2)
-lhs = argn(1)
-
-if(rhs>5 | rhs<3)
-error("wrong number of input arguments.")
-end
-if(lhs<4 | lhs<2)
-error("Wrong number of output arguments.")
-end
-
-select (rhs)
- case 3 then
- if (lhs==2) [a,b] = callOctave("cheby2",n, rp, w)
- elseif (lhs==3) [a,b,c] = callOctave("cheby2",n, rp, w)
- elseif (lhs==4) [a,b,c,d] = callOctave("cheby2",n, rp, w)
- end
- case 4 then
- if (lhs==2) [a,b] = callOctave("cheby2",n, rp, w, varargin(1))
- elseif (lhs==3) [a,b,c] = callOctave("cheby2",n, rp, w, varargin(1))
- elseif (lhs==4) [a,b,c,d] = callOctave("cheby2",n, rp, w, varargin(1))
- end
- case 5 then
- if (lhs==2) [a,b] = callOctave("cheby2",n, rp, rs, w, varargin(1), varargin(2))
- elseif (lhs==3) [a,b,c] = callOctave("cheby2",n, rp, rs, w, varargin(1), varargin(2))
- elseif (lhs==4) [a,b,c,d] = callOctave("cheby2",n, rp, rs, w, varargin(1), varargin(2))
- end
- end
diff --git a/macros/decimate.sci~ b/macros/decimate.sci~
deleted file mode 100644
index 376241a..0000000
--- a/macros/decimate.sci~
+++ /dev/null
@@ -1,48 +0,0 @@
-function y = decimate(x, q, n, ftype)
-rhs = argn(2)
-if(rhs<2 | rhs>4)
-error("Wrong number of input arguments.")
-end
-elseif(~(sum(length(q)==1) & q == fix (q) & q > 0))
-error("Parameter 2 must be a positive integer.")
-end
-if (nargin < 3)
-ftype = "iir"
-n = []
-elseif (nargin < 4)
-if (ischar (n))
-ftype = n
-n = []
-else
-ftype = "iir"
-end
-end
-
-if (~ and(strcmp (ftype, {"fir", "iir"})))
-error("Filter type must be either fir or iir.")
-end
-
-fir = strcmp (ftype, "fir")
-if (isempty (n))
-if (fir)
-n = 30
-else
-n = 8
-end
-end
-
-if(~(sum(length(n)==1) & n == fix (n) & n > 0))
-error("N must be a positive integer.")
-end
-select(rhs)
-case 2 then
-y = callOctave("decimate", x, q)
-case 3 then
-y = callOctave("decimate", x, q, n)
-case 4 then
-y = callOctave("decimate", x, q, n, ftype)
-end
-endfunction
-
-
-
diff --git a/macros/fwhmjlt.sci~ b/macros/fwhmjlt.sci~
deleted file mode 100644
index 93fc505..0000000
--- a/macros/fwhmjlt.sci~
+++ /dev/null
@@ -1,18 +0,0 @@
-
-rhs = argn(2)
-if(rhs<1 | rhs>5)
-error("Wrong number of input arguments.")
-end
- select(rhs)
- case 1 then
- f = callOctave("fwhm",y)
- case 2 then
- f = callOctave("fwhm",y,varargin(1))
- case 3 then
- f = callOctave("fwhm",y,varargin(1),varargin(2))
- case 4 then
- f = callOctave("fwhm",y,varargin(1),varargin(2),varargin(3))
- case 5 then
- f = callOctave("fwhm",y,varargin(1),varargin(2),varargin(3),varargin(4))
- end
-endfunction
diff --git a/macros/medfilt1.sci~ b/macros/medfilt1.sci~
deleted file mode 100644
index 0a41f12..0000000
--- a/macros/medfilt1.sci~
+++ /dev/null
@@ -1,346 +0,0 @@
-function y = medfilt1(x, varargin)
- // 1D median filtering
- //
- // Calling sequence
- // y = medfilt1(x)
- // y = medfilt1(x, n)
- // y = medfilt1(x, n, dim)
- // y = medfitl1(__, nanflag, padding)
- //
- // Description
- // y = medfilt1(x)
- // Applies a 3rd order 1-dimensional median filter to input x along the
- // first non-zero dimension. The function appropriately pads the signal
- // with zeros at the endings. For a segment, a median is calculated as
- // the middle value (average of two middle values) for odd number
- // number (even number) of data points.
- // y = medfilt1(x,n)
- // Applies a nth order 1-dimensional median filter.
- // y = medfilt1(x,n,dim)
- // Applies the median filter along the n-th dimension
- // y = medfilt1(__, nanflag, padding)
- // nanflag specifies how NaN values are treated. padding specifies the
- // type of filtering to be performed at the signal edges.
- //
- // Parameters
- // x: int | double
- // Input signal.
- // n: positive integer scalar
- // Filter order.
- // Defaults to 3.The order of the median filter. Must be less than
- // (length of the signal) where signals are 1D vectors along the
- // dimension of x to be filtered
- // dim: positive integer scalar
- // Dimension to filter along.
- // Defaults to first non-singleton dimension of x
- // nanflag: 'includenan' (default) | 'omitnan'
- // NaN condition.
- // * includenan: Filtering such that the median of any segment
- // containing a NaN is also a NaN.
- // * omitnan: Filtering with NaNs omitted in each segment. If a segment
- // contains all NaNs, the result is NaN
- // y: int | double
- // The filtered signal.
- // y has the same size as x
- //
- // Examples
- // 1) Noise supression using median filtering
- // fs = 1e3;
- // t = 1:1/fs:1;
- // s = sin(2*%pi*2*t)+ cos(2*%pi*5*t);
- // // Adding noise
- // x = s + 0.1*randn(size(s));
- // y = medfilt1(x);
- //
- // See also
- // filter | hampel | median | sgolayfilt
- //
- // Authors
- // Ayush Baid
-
-
-
- // *************************************************************************
- // Checking number of arguments
- // *************************************************************************
- [numOutArgs, numInArgs] = argn(0);
-
- if numInArgs<1 | numInArgs>5 then
- msg = "medfilt1: Wrong number of input argument; 1-5 expected";
- error(77, msg);
- end
- if numOutArgs~=1 then
- msg = "medfilt1: Wrong number of output argument; 1 expected";
- error(78, msg);
- end
-
-
-
- // *************************************************************************
- // Parsing input arguments
- // *************************************************************************
-
- // * Parsing x *
- temp = x(:);
- if type(temp)~=1 & type(temp)~=8 then
- msg = "medfilt1: Wrong type for argument #1 (x): Int/double expected"
- error(53, msg);
- end
-
-
- // * Parsing nanflag and padding *
- // Getting all the string arguments
- stringIndices = list();
- for i=1:length(varargin);
- e = varargin(i);
- if type(e)==10 then
- stringIndices($+1)=i;
- end
- end
-
- nanflag = %f; // 0->includenan (default); 1->omitnan
- padflag = %t; // 1->zeropad (default); 0->truncate
- if ~isempty(stringIndices) then
- // checking for 'omitnan'
- if or(strcmpi(varargin(stringIndices), 'omitnan')) then
- nanflag = %t;
- end
-
- // checking for 'truncate'
- if or(strcmpi(varargin(stringIndices), 'truncate')) then
- padflag = %f;
- end
- varargin(stringIndices) = [];
- end
-
-
- // setting default value for n and dim
- n = 3;
- dim = 1;
- L = length(size(x));
- for i=1:L
- if size(x, i)>1 then
- dim = i;
- end
- end
-
- // * Parsing n and dim *
- if length(varargin)==1 then
- if ~isempty(varargin(1)) then
- n = varargin(1);
- end
- elseif length(varargin)==2 then
- if ~isempty(varargin(1)) then
- n = varargin(1);
- end
- if ~isempty(varargin(2)) then
- dim = varargin(2);
- end
- else
- msg = "medfilt1: Wrong type of input arguments; Atmost 3 numerical input expected";
- error(53, msg);
- end
-
- // check on n
- if length(n)~=1 then
- msg = "medfilt1: Wrong size for argument #2 (n): Scalar expected";
- error(60,msg);
- end
-
- if type(n)~=1 & type(n)~=8 then
- msg = "medfilt1: Wrong type for argument #2 (n): Natural number expected";
- error(53,msg);
- end
-
- if n~=round(n) | n<=0 then
- msg = "medfilt1: Wrong type for argument #2 (n): Natural number expected";
- error(53,msg);
- end
-
- if ~isreal(n) then
- msg = "medfilt1: Wrong type for argument #2 (n): Real scalar expected";
- error(53,msg);
- end
-
- // check on dim
- if length(dim)~=1 then
- msg = "medfilt1: Wrong size for argument #3 (dim): Scalar expected";
- error(60,msg);
- end
-
- if type(dim)~=1 & type(dim)~=8 then
- msg = "medfilt1: Wrong type for argument #3 (dim): Natural number expected";
- error(53,msg);
- end
-
- if dim~=round(dim) | dim<=0 then
- msg = "medfilt1: Wrong type for argument #3 (dim): Natural number expected";
- error(53,msg);
- end
-
- if ~isreal(dim) then
- msg = "medfilt1: Wrong type for argument #3 (dim): Real scalar expected";
- error(53,msg);
- end
-
-
- // *************************************************************************
- // Processing for median filtering column by column
- // *************************************************************************
-
- inp_size = size(x);
-
-
- // Permuting x to bring the dimension to be acted upon as the first dimesnion
- perm_vec = [2:dim, 1, dim+1:length(inp_size)];
- reverse_perm_vec = [dim, 1:dim-1, dim+1:length(inp_size)];
- x = permute(x, perm_vec);
-
- size_vec = size(x);
-
- y = x; // just initialization
-
- for i=1:prod(size_vec(2:$))
- temp = medfilt_colvector(x(:,i), n, padflag, nanflag);
- y(:,i) = temp;
- end
-
-
-
- y = permute(y, reverse_perm_vec);
-
-
-endfunction
-
-function med = medfilt_colvector(x, n, zeropadflag, nanflag)
- // Performs median filtering (of order n) on a column vector (x)
- // zeropadflag -> zero pad instead of truncation
- // nanflag -> discard all blocks containing nan, else do not consider nan values
-
- med = zeros(size(x,1),1);
- disp('here1');
-
-
- // ** zero pad the signal **
- pad_length = floor(n/2); // padding on a size
- x = [zeros(pad_length,1); x; zeros(pad_length,1)];
-
- nx = length(x);
-
- // Arrange data in blocks
- top_row = 1:(nx-n);
-
- idx = zeros(n,length(top_row));
-
- for i=1:n
- idx(i,:) = top_row + (i-1);
- end
-
- blocks = matrix(x(idx), size(idx));
-
-
- if nanflag then
- disp('here2');
- med = median(blocks, 1)';
-
- // set result of all the blocks containing nan to nan
- nanpresent = or(isnan(blocks), 1);
- med(nanpresent) = %nan;
- else
- disp('here3');
- // we have to neglect nans
- sorted_blocks = gsort(blocks, 'r', 'i');
-
- // get the count of non-nan elements
- num_elems = n - sum(isnan(sorted_blocks), 1);
-
- // find the median
- offset = (0:size(blocks,2)-1)*size(blocks,1);
- idx1 = offset+ceil(num_elems/2);
- idx2 = offset+ceil((num_elems/2)+0.25);
-
-
- // temporarily setting idx1 to 1 so as to not give errors in median calc.
- // Will later replace values at such indices with Nan
- idx1(idx1==0)=1;
- med = (sorted_blocks(idx1) + sorted_blocks(idx2))./2;
-
- med(idx1==0) = %nan;
- end
-
- if ~zeropadflag then
- // ** recalculate boundary blocks with truncation truncate at the boundaries **
-
- // divide the input signal into 3 parts; 1st and last part have truncation
- for i=ceil(n/2):n
- // ** first part **
- block = x(1:i);
-
- // * median calc for a block *
- if nanflag then
- med(i-ceil(n/2)+1) = median(block, 1);
-
- // set result of all the blocks containing nan to nan
- nanpresent = or(isnan(block), 1);
- if nanpresent then
- med(i-ceil(n/2)+1) = %nan;
- end
- else
- // we have to neglect nans
- sorted_block = gsort(block, 'r', 'i');
-
- // get the count of non-nan elements
- num_elems = length(block) - sum(isnan(sorted_block), 1);
-
- // find the median
- idx1 = ceil(num_elems/2);
- idx2 = ceil(num_elems/2+0.25);
-
-
- // temporarily setting idx1 to 1 so as to not give errors in median calc.
- // Will later replace values at such indices with Nan
- if idx1==0 then
- med(i-ceil(n/2)+1) = %nan;
- else
- med(i-ceil(n/2)+1) = (sorted_block(idx1, :)+sorted_block(idx2, :))./2;
- end
- end
-
-
- // ** last part **
- block = x($:-1:$-i);
-
- // * median calc for a block *
- if nanflag then
- med($+ceil(n/2)-i) = median(block, 1);
-
- // set result of all the blocks containing nan to nan
- nanpresent = or(isnan(block), 1);
- if nanpresent then
- med($-ceil(n/2)+i) = %nan;
- end
- med($+ceil(n/2)-i) = %nan;
- end
- else
- // we have to neglect nans
- sorted_block = gsort(block, 'r', 'i');
-
- // get the count of non-nan elements
- num_elems = length(block) - sum(isnan(sorted_block), 1);
-
- // find the median
- idx1 = ceil(num_elems/2);
- idx2 = ceil(num_elems/2+0.25);
-
- // temporarily setting idx1 to 1 so as to not give errors in median calc.
- // Will later replace values at such indices with Nan
- if idx1==0 then
- med($+ceil(n/2)-i) = %nan;
- else
- med($+ceil(n/2)-i) = (sorted_block(idx1) + sorted_block(idx2))./2;
- end
- end
- end
- end
-
-endfunction
diff --git a/macros/names~ b/macros/names~
deleted file mode 100644
index e69de29..0000000
--- a/macros/names~
+++ /dev/null
diff --git a/macros/polyval.sci~ b/macros/polyval.sci~
deleted file mode 100755
index 8301ff5..0000000
--- a/macros/polyval.sci~
+++ /dev/null
@@ -1,69 +0,0 @@
-function [y, delta] = polyval(p,x,S,mu)
-
-// Check input is a vector
-if ~(isvector(p) | isempty(p))
- error(message('polyval:InvalidP'));
-end
-
-nc = length(p);
-if isscalar(x) & (argn(2) < 3) & nc>0 & isfinite(x) & all(isfinite(p(:)))
- // Make it scream for scalar x. Polynomial evaluation can be
- // implemented as a recursive digital filter.
- y = filter(1,[1 -x],p);
- y = y(nc);
- return
-end
-
-siz_x = size(x);
-if argn(2) == 4
- x = (x - mu(1))/mu(2);
-end
-
-// Use Horner's method for general case where X is an array.
-y = zeros(size(x,1),size(x,2));
-if nc>0, y(:) = p(1); end
-for i=2:nc
- y = x .* y + p(i);
-end
-
-if argn(1) > 1
- if argn(2) < 3 | isempty(S)
- error(message('polyval:RequiresS'));
- end
-
- // Extract parameters from S
- if isstruct(S), // Use output structure from polyfit.
- R = S.R;
- df = S.df;
- normr = S.normr;
- else // Use output matrix from previous versions of polyfit.
- [ms,ns] = size(S);
- if (ms ~= ns+2) | (nc ~= ns)
- error(message('polyval:SizeS'));
- end
- R = S(1:nc,1:nc);
- df = S(nc+1,1);
- normr = S(nc+2,1);
- end
-
- // Construct Vandermonde matrix for the new X.
- x = x(:);
- V(:,nc) = ones(length(x),1,class(x));
- for j = nc-1:-1:1
- V(:,j) = x.*V(:,j+1);
- end
-
- // S is a structure containing three elements: the triangular factor of
- // the Vandermonde matrix for the original X, the degrees of freedom,
- // and the norm of the residuals.
- E = V/R;
- e = sqrt(1+sum(E.*E,2));
- if df == 0
- warning(message('polyval:ZeroDOF'));
- delta = Inf(size(e));
- else
- delta = normr/sqrt(df)*e;
- end
- delta = reshape(delta,siz_x);
-end
-
diff --git a/macros/schurrc.sci~ b/macros/schurrc.sci~
deleted file mode 100644
index 71beb39..0000000
--- a/macros/schurrc.sci~
+++ /dev/null
@@ -1,49 +0,0 @@
-//schurrc - Schur algorithm.
-//K = SCHURRC(R) computes the reflection coefficients from autocorrelation vector R. If R is a matrix, SCHURRC finds coefficients for each column of R, and returns them in the columns of K.
-//[K,E] = SCHURRC(R) returns the prediction error variance E. If R is a matrix, SCHURRC finds the error for each column of R, and returns them in the rows of E.
-//Modified to match matlab i/p and o/p and handle exceptions
-//Fixed bugs
-//by Debdeep Dey
-function [k,e] = schurrc(R)
- narginchk(1,1,argn(2));
-if(type(R)==10) then
- w=R;
- [nr,nc]=size(R);
- if(nr==1 & nc==1) then
- R=ascii(R);
- R=matrix(R,length(w));
- else
-
- R=ascii(R);
- R=matrix(R,size(w));
- end
-
-end
-if(type(R) > 1) then
- error('Input R is not a matrix')
-end
-if (min(size(R)) == 1) then
- R = R(:);
-end
-[m,n] = size(R);
-// Compute reflection coefficients for each column of the input matrix
-for j = 1:n
- X = R(:,j).';
- // Schur's iterative algorithm on a row vector of autocorrelation values
- U = [0 X(2:m); X(1:m)];
-
- for i = 2:m,
- U(2,:) = [0 U(2,1:m-1)];
- k(i-1,j) = -U(1,i)/U(2,i);
- U = [1 k(i-1,j); conj(k(i-1,j)) 1]*U;
- end
-
- e(j,1) = U(2,$);
-end
-endfunction
-function narginchk(l,h,t)
- if t<l then
- error("Too few input arguments");
- elseif t>l then
- error("Too many i/p arguments");
- end
diff --git a/macros/taylorwin.sci~ b/macros/taylorwin.sci~
deleted file mode 100644
index 85ab015..0000000
--- a/macros/taylorwin.sci~
+++ /dev/null
@@ -1,83 +0,0 @@
-//Taylor Window
-TAYLORWIN(N) returns an N-point Taylor window in a column vector.
-//
-// TAYLORWIN(N,NBAR) returns an N-point Taylor window with NBAR nearly
-// constant-level sidelobes adjacent to the mainlobe. NBAR must be an
-// integer greater than or equal to one.
-//
-// TAYLORWIN(N,NBAR,SLL) returns an N-point Taylor window with SLL maximum
-// sidelobe level in dB relative to the mainlobe peak. SLL must be a
-// negative value, e.g., -30 dB.
-//
-//NBAR should satisfy NBAR >= 2*A^2+0.5, where A is equal to
-//acosh(10^(-SLL/20))/pi, otherwise the sidelobe level specified is not
-//guaranteed. If NBAR is not specified it defaults to 4. SLL defaults to
-//-30 dB if not specified.
-
-//Author: Parthasarathi Panda
-//parthasarathipanda314@gmail.com
-//the function is for application on vectors only
-//Modified function to reject negative window length and no of constant level sidelobes with appropriate error messages
-function [w]=taylorwin(n,nbar,sll)
- [nargout,nargin]=argn();
- if nargin<1 then
- error("Not enough input arguments")
- end
- if nargin==1 then
- nbar=4;
- sll=-30;
- elseif nargin==2
- sll=-30;
- end
- if type(n)~=1 | type(nbar)~=1 | type(sll)~=1 then
- error('check the data type of input'); //to check if the inputs are real/complex arrays
- end
-
- if size(n)~=[1,1] then
- error('check the data type of input'); //to check that n is single dimensional
- end
- if floor(n)~=n | imag(n)~=0 then
- error('check that n is an integer');//to check if n is an integer
- end
-
- if size(nbar)~=[1,1] then
- error('check the data type of input'); //to check that nbar is single dimensional
- end
- if floor(nbar)~=nbar | imag(nbar)~=0 then
- error('check that nbar is an integer');//to check if nbar is an integer
- end
-
- if size(sll)~=[1,1] then
- error('check the data type of input'); //to check that sll is single dimensional
- end
- if sll>0 | imag(sll)~=0 then
- error('The sidelobe level SLL must be a negative number.');//to check if sll is a negative no.
- end
- //check if window length is positive
- if(n<0) then
- error("The window length must be a positive integer");
- end
- //check if no of constant level sidelobes is positive
- if (nbar<=0) then
- error("The number of nearly constant-level sidelobes NBAR must be a positive integer greater than 0.");
- end
- B=10^(-sll/20);
- A=log(B+sqrt(B*B-1))/%pi;
- sig=nbar*nbar/(A*A+(nbar-0.5)*(nbar-0.5));
- //computing Fm (the coefficients for the cosines
- m=ones(nbar-1,1)*[1:nbar-1];
- i=([1:nbar-1])'*ones(1,nbar-1);
- M=((1-((m.*m/sig)./(A*A+(i-0.5).*(i-0.5)))));//./(1-(m.*m)./(i.*i)));
- m=[1:nbar-1];
- F=prod(M,1).*((-1)^(m+1));
- for m=1:nbar-1
- j=[[1:m-1],[m+1:nbar-1]];
- F(m)=F(m)/prod((1-(m.*m)./(j.*j)));
- end
- //computing the window
- nv=ones(nbar-1,1)*([0:n-1]);
- m=([1:nbar-1])'*ones(1,n);
- M=cos(2*%pi*m.*(nv-(n-1)/2)/n);
- w=ones(1,n)+F*M;
- w=w';
-endfunction