summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunil Shetye2018-07-25 17:11:09 +0530
committerSunil Shetye2018-07-26 23:50:17 +0530
commit1251f70aa3442736ce6fd9c4fb7fbce412af5a52 (patch)
tree360311ffaf6151c5066439f481e8ac38cfd047b9
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
-rw-r--r--help/en_US/ac2poly.xml2
-rw-r--r--help/en_US/armcov.xml41
-rw-r--r--help/en_US/buffer.xml10
-rw-r--r--help/en_US/cconv.xml51
-rw-r--r--help/en_US/cummax.xml34
-rw-r--r--help/en_US/decimate.xml58
-rw-r--r--help/en_US/filtfilt.xml7
-rw-r--r--help/en_US/filtic.xml15
-rw-r--r--help/en_US/firtype.xml42
-rw-r--r--help/en_US/fwhmjlt.xml35
-rw-r--r--help/en_US/fwht.xml2
-rw-r--r--help/en_US/helperHarmonicDistortion.xml81
-rw-r--r--help/en_US/helperHarmonicDistortionAmplifier.xml23
-rw-r--r--help/en_US/icceps.xml39
-rw-r--r--help/en_US/impz.xml51
-rw-r--r--help/en_US/impzlength.xml42
-rw-r--r--help/en_US/intfilt.xml58
-rw-r--r--help/en_US/is2rc.xml34
-rw-r--r--help/en_US/isallpass.xml72
-rw-r--r--help/en_US/oct_interp.xml (renamed from help/en_US/interp.xml)6
-rw-r--r--macros/armcov.sci37
-rw-r--r--macros/barthannwin.sci45
-rw-r--r--macros/blackmanharris.sci67
-rw-r--r--macros/blackmannuttall.sci74
-rw-r--r--macros/bohmanwin.sci45
-rw-r--r--macros/boxcar.sci36
-rw-r--r--macros/cconv.sci52
-rw-r--r--macros/cheb.sci61
-rw-r--r--macros/chebwin.sci72
-rw-r--r--macros/check.sci7
-rw-r--r--macros/cummax.sci10
-rw-r--r--macros/decimate.sci43
-rw-r--r--macros/filtfilt.sci4
-rw-r--r--macros/filtic.sci3
-rw-r--r--macros/fir1.sci147
-rw-r--r--macros/fir2.sci159
-rw-r--r--macros/firtype.sci21
-rw-r--r--macros/flattopwin.sci65
-rw-r--r--macros/fwhmjlt.sci24
-rw-r--r--macros/hamming.sci53
-rw-r--r--macros/hann.sci8
-rw-r--r--macros/hanning.sci52
-rw-r--r--[-rwxr-xr-x]macros/helperHarmonicDistortion.sci (renamed from macros/helperHarmonicDistortionAmplifier.sci)25
-rw-r--r--macros/icceps.sci7
-rw-r--r--macros/impinvar.sci9
-rw-r--r--macros/impz.sci20
-rw-r--r--macros/impzlength.sci13
-rw-r--r--macros/interp.sci38
-rw-r--r--macros/intfilt.sci196
-rw-r--r--macros/is2rc.sci86
-rw-r--r--macros/isallpass.sci24
-rw-r--r--macros/nuttallwin.sci61
-rw-r--r--macros/oct_interp.sci105
-rw-r--r--macros/parzenwin.sci36
-rw-r--r--macros/rectwin.sci31
-rw-r--r--macros/roundn.sci3
-rw-r--r--macros/triang.sci31
-rw-r--r--macros/tukeywin.sci91
-rw-r--r--macros/txt1_armcov.txt1024
-rw-r--r--macros/txt2_decimate.txt1001
-rw-r--r--macros/txt3_helperHDA.txt2206
-rw-r--r--macros/wind.sci50
-rw-r--r--macros/window.sci35
-rw-r--r--test2.sce605
64 files changed, 6720 insertions, 765 deletions
diff --git a/help/en_US/ac2poly.xml b/help/en_US/ac2poly.xml
index e90759d..33cbd96 100644
--- a/help/en_US/ac2poly.xml
+++ b/help/en_US/ac2poly.xml
@@ -57,6 +57,6 @@ Parthe Pandit
<refsection>
<title>Bibliography</title>
- <para>Kay, Steven M. Modern Spectral Estimation. Englewood Cliffs, NJ: Prentice-Hall, 1988.</para>
+ <para>kartik Kay, Steven M. Modern Spectral Estimation. Englewood Cliffs, NJ: Prentice-Hall, 1988.</para>
</refsection>
</refentry>
diff --git a/help/en_US/armcov.xml b/help/en_US/armcov.xml
index 62e33b7..79ed57c 100644
--- a/help/en_US/armcov.xml
+++ b/help/en_US/armcov.xml
@@ -17,7 +17,46 @@
<refnamediv>
<refname>armcov</refname>
- <refpurpose></refpurpose>
+ <refpurpose>This function uses the modified covariance method to fit a pth-order autoregressive (AR) model to the input signal x </refpurpose>
</refnamediv>
+<refsynopsisdiv>
+ <title>Calling Sequence</title>
+ <synopsis>
+ a=armcov(x,p)
+ [a,e] = armcov(x,p)
+ </synopsis>
+</refsynopsisdiv>
+
+<refsection>
+ <title>Parameters</title>
+ <variablelist>
+ <varlistentry><term>x:</term>
+ <listitem><para> input signal</para></listitem></varlistentry>
+ <varlistentry><term>p:</term>
+ <listitem><para> order</para></listitem></varlistentry>
+ <varlistentry><term>a:</term>
+ <listitem><para> output of an AR system driven by white noise</para></listitem></varlistentry>
+ <varlistentry><term>e:</term>
+ <listitem><para> variance estimate</para></listitem></varlistentry>
+ </variablelist>
+</refsection>
+
+<refsection>
+ <title>Description</title>
+ <para>
+This function uses the modified covariance method to fit a pth-order autoregressive (AR) model to the input signal x.
+</para>
+</refsection>
+
+<refsection>
+ <title>Examples</title>
+ <programlisting role="example"><![CDATA[
+A = [1 -2.7607 3.8106 -2.6535 0.9238];
+y = filter(1,A,0.2*rand(1024,1,"normal"));
+arcoeffs = armcov(y,4)
+
+ ]]></programlisting>
+
+</refsection>
</refentry>
diff --git a/help/en_US/buffer.xml b/help/en_US/buffer.xml
index 24b5214..9a8db7b 100644
--- a/help/en_US/buffer.xml
+++ b/help/en_US/buffer.xml
@@ -56,11 +56,11 @@ This function buffers the given data into a matrix of signal frames
<title>Examples</title>
<programlisting role="example"><![CDATA[
buffer(1,3,2)
-ans =
-0 0
-0 1
-1 0
-This function is being called from Octave
+//ans =
+//0 0
+//0 1
+//1 0
+//This function is being called from Octave
]]></programlisting>
</refsection>
</refentry>
diff --git a/help/en_US/cconv.xml b/help/en_US/cconv.xml
index 5c9a665..3cb0ea8 100644
--- a/help/en_US/cconv.xml
+++ b/help/en_US/cconv.xml
@@ -17,7 +17,56 @@
<refnamediv>
<refname>cconv</refname>
- <refpurpose>[nargout,nargin]=argn();</refpurpose>
+ <refpurpose> circularly convolves vectors a and b. n is the length of the resulting vector. </refpurpose>
</refnamediv>
+<refsynopsisdiv>
+ <title>Calling Sequence</title>
+ <synopsis>
+ o = cconv(a,b)
+ o = cconv(a,b,n)
+ </synopsis>
+</refsynopsisdiv>
+
+<refsection>
+ <title>Parameters</title>
+ <variablelist>
+ <varlistentry><term>a:</term>
+ <listitem><para> a real or complex vector.</para></listitem></varlistentry>
+ <varlistentry><term>b:</term>
+ <listitem><para> a real or complex vector.</para></listitem></varlistentry>
+ <varlistentry><term>n:</term>
+ <listitem><para> length of circular convolution</para></listitem></varlistentry>
+ <varlistentry><term>o:</term>
+ <listitem><para> convolution sequence</para></listitem></varlistentry>
+ </variablelist>
+</refsection>
+
+<refsection>
+ <title>Description</title>
+ <para>
+This function buffers the given data into a matrix of signal frames
+</para>
+</refsection>
+
+<refsection>
+ <title>Examples</title>
+ <programlisting role="example"><![CDATA[
+a=[1 2 3]
+b=[4 5 6]
+o=cconv(a,b,3)
+
+//Output : o= 31 31 28
+ ]]></programlisting>
+
+ <programlisting role="example"><![CDATA[
+a=[1 2+%i 4]
+b=[2 3*%i 5]
+o=cconv(a,b)
+o=clean(o)
+
+//Output: o= 2. 4. + 5.i 10. + 6.i 10. + 17.i 20.
+ ]]></programlisting>
+</refsection>
+
</refentry>
diff --git a/help/en_US/cummax.xml b/help/en_US/cummax.xml
index 76c863a..e385ac0 100644
--- a/help/en_US/cummax.xml
+++ b/help/en_US/cummax.xml
@@ -25,32 +25,42 @@
<title>Calling Sequence</title>
<synopsis>
M = cummax(A)
- returns the cumulative maximum of the arguments of A. The dimension
- of M is same as the dimension of A. If A is a 2D matrix, the operation
- is performed along the columns. For a hypermatrix, the operation is
- performed along the first non-zero dimension
M = cummax(A,dim)
- The operation is performed along the dimension specified by dim
M = cummax(_,direction)
- direction specifies as the direction of operation
-
</synopsis>
</refsynopsisdiv>
<refsection>
<title>Parameters</title>
<variablelist>
+
+ <varlistentry><term>A:</term>
+ <listitem><para> positive integer value<para></para>For complex elements, cummax compares the magnitude of elements. If the magnitude are same, phase angles are compared.</para></listitem></varlistentry>
+ <varlistentry><term>dim:</term>
+ <listitem><para> Dimension to operate along<para></para>If no dimension is specified, then the default value is the first array dimension whose value is greater than 1 </para></listitem></varlistentry>
+ <varlistentry><term>direction:</term>
+ <listitem><para>Direction of cumulation<para></para>If the direction is forward, cummax works from 1 to end of the active dimension. Otherwise, it works in the opposite sense</para></listitem></varlistentry>
+
</variablelist>
</refsection>
<refsection>
+ <title>Description</title>
+ <para>
+The function returns the cumulative maximum elements of the input vector/array.
+
+
+</para>
+</refsection>
+
+<refsection>
<title>Examples</title>
<programlisting role="example"><![CDATA[
-1) Cumulative maximum values in a vector
+Cumulative maximum values in a vector
v = [8 9 1 10 6 1 3 6 10 10]
M = cummax(v)
-Expected output: [8 8 1 1 1 1 1 1 1 1]
+//Expected output: [8 9 9 10 10 10 10 10 10 10]
]]></programlisting>
</refsection>
@@ -62,9 +72,5 @@ Expected output: [8 8 1 1 1 1 1 1 1 1]
</simplelist>
</refsection>
-<refsection>
- <title>See also</title>
- <simplelist type="inline">
- </simplelist>
-</refsection>
+
</refentry>
diff --git a/help/en_US/decimate.xml b/help/en_US/decimate.xml
index bc0efe7..30440dd 100644
--- a/help/en_US/decimate.xml
+++ b/help/en_US/decimate.xml
@@ -17,7 +17,63 @@
<refnamediv>
<refname>decimate</refname>
- <refpurpose>rhs = argn(2)</refpurpose>
+ <refpurpose>Decimation — decrease sample rate by integer factor</refpurpose>
</refnamediv>
+<refsynopsisdiv>
+ <title>Calling Sequence</title>
+ <synopsis>
+ y = decimate(x,q)
+ y = decimate(x,q,n)
+ y = decimate (…, "fir")
+ </synopsis>
+</refsynopsisdiv>
+
+<refsection>
+ <title>Parameters</title>
+ <variablelist>
+ <varlistentry><term>x:</term>
+ <listitem><para> input sequence</para></listitem></varlistentry>
+ <varlistentry><term>q:</term>
+ <listitem><para> reduction factor </para></listitem></varlistentry>
+ <varlistentry><term>n:</term>
+ <listitem><para> filter order</para></listitem></varlistentry>
+ <varlistentry><term>ftype:</term>
+ <listitem><para> filter type: iir or fir</para></listitem></varlistentry>
+ </variablelist>
+</refsection>
+
+<refsection>
+ <title>Description</title>
+ <para>
+y = decimate(x,q) reduces the sample rate of x, the input signal, by a factor of q.
+By default, an order n Chebyshev type I filter is used. If n is not specified, the default is 8.
+If the optional argument "fir" is given, an order n FIR filter is used, with a default order of 30 if n is not given.
+Note that q must be an integer for this rate change method.
+</para>
+</refsection>
+
+<refsection>
+ <title>Examples</title>
+ <programlisting role="example"><![CDATA[
+t = 0:.00025:1;
+x = sin(2*%pi*30*t) + sin(2*%pi*60*t);
+y = decimate(x,4);
+subplot(211)
+plot2d3((0:120),x(1:121))
+subplot(212)
+plot2d3((0:30),y(1:31))
+ ]]></programlisting>
+
+</refsection>
+
+
+<refsection>
+ <title>Authors</title>
+ <simplelist type="vert">
+ <member>Ayush Baid</member>
+ </simplelist>
+</refsection>
+
+
</refentry>
diff --git a/help/en_US/filtfilt.xml b/help/en_US/filtfilt.xml
index baf8dfe..e8d9c99 100644
--- a/help/en_US/filtfilt.xml
+++ b/help/en_US/filtfilt.xml
@@ -17,7 +17,7 @@
<refnamediv>
<refname>filtfilt</refname>
- <refpurpose></refpurpose>
+ <refpurpose> Zero phase digital filtering </refpurpose>
</refnamediv>
@@ -51,8 +51,9 @@ In theory, it forwards and reverse filters the signal and corrects phase distort
<refsection>
<title>Examples</title>
<programlisting role="example"><![CDATA[
-1. [a,b]=filtfilt (1,2i,[i -4 0])
-a = [0.00000 - 0.25000i 1.00000 + 0.00000i 0.00000 + 0.00000i]
+1. [a]=filtfilt (1,2i,[i -4 0])
+//Expected output
+//a = [-0.25i 1 0]
]]></programlisting>
</refsection>
</refentry>
diff --git a/help/en_US/filtic.xml b/help/en_US/filtic.xml
index ec5e08e..f27f53e 100644
--- a/help/en_US/filtic.xml
+++ b/help/en_US/filtic.xml
@@ -17,7 +17,7 @@
<refnamediv>
<refname>filtic</refname>
- <refpurpose></refpurpose>
+ <refpurpose>This function finds the initial conditions for the delays in the transposed direct-form II filter implementation</refpurpose>
</refnamediv>
@@ -54,12 +54,13 @@ The vectors b and a represent the numerator and denominator coefficients of the
<refsection>
<title>Examples</title>
<programlisting role="example"><![CDATA[
-filtic([i,1,-i,5], [1,2,3i], [0.8i,7,9])
-ans =
-0.00000 - 22.60000i
-2.40000 + 0.00000i
-0.00000 + 0.00000i
-This function is being called from Octave
+filtic([%i,1,-%i,5], [1,2,3*%i], [0.8*%i,7,9])
+//Expected Output:
+//ans =
+//-22.6i
+// 2.4
+// 0
+
]]></programlisting>
</refsection>
</refentry>
diff --git a/help/en_US/firtype.xml b/help/en_US/firtype.xml
index 8050565..c4bc7e5 100644
--- a/help/en_US/firtype.xml
+++ b/help/en_US/firtype.xml
@@ -17,7 +17,47 @@
<refnamediv>
<refname>firtype</refname>
- <refpurpose>if (type(b)~=1) then</refpurpose>
+ <refpurpose> This function identifies Type of linear phase FIR filter
+</refpurpose>
</refnamediv>
+<refsynopsisdiv>
+ <title>Calling Sequence</title>
+ <synopsis>
+ t=firtype(b)
+ </synopsis>
+</refsynopsisdiv>
+
+<refsection>
+ <title>Parameters</title>
+ <variablelist>
+ <varlistentry><term>t:</term>
+ <listitem><para> type of an FIR filter </para></listitem></varlistentry>
+ <varlistentry><term>b:</term>
+ <listitem><para> Filter coefficients</para></listitem></varlistentry>
+
+ </variablelist>
+</refsection>
+
+<refsection>
+ <title>Description</title>
+ <para>
+"t = firtype(b)" determines the type, t, of an FIR filter with coefficients b. </para><para>"t" can be 1, 2, 3, or 4. </para><para>
+The filter must be real and have linear phase.
+
+</para>
+</refsection>
+
+<refsection>
+ <title>Examples</title>
+ <programlisting role="example"><![CDATA[
+b=[9.2762e-05 9.5482e-02 4.0443e-01 4.0443e-01 9.5482e-02 9.2762e-05]
+firtype(b)
+//Expected Output
+//2
+ ]]></programlisting>
+</refsection>
+
+
+
</refentry>
diff --git a/help/en_US/fwhmjlt.xml b/help/en_US/fwhmjlt.xml
index 4663d1a..c093385 100644
--- a/help/en_US/fwhmjlt.xml
+++ b/help/en_US/fwhmjlt.xml
@@ -17,7 +17,40 @@
<refnamediv>
<refname>fwhmjlt</refname>
- <refpurpose>rhs = argn(2)</refpurpose>
+ <refpurpose>This function Computes peak full-width at half maximum</refpurpose>
</refnamediv>
+<refsynopsisdiv>
+ <title>Calling Sequence</title>
+ <synopsis>
+ f = fwhm (y)
+ f = fwhm (x, y)
+ f = fwhm (…, "zero")
+ f = fwhm (…, "min")
+ f = fwhm (…, "alevel", level)
+ f = fwhm (…, "rlevel", level)
+ </synopsis>
+</refsynopsisdiv>
+
+
+
+<refsection>
+ <title>Description</title>
+ <para>
+Compute peak full-width at half maximum (FWHM) or at another level of peak maximum for vector or matrix data y, optionally sampled as y(x). If y is a matrix, return FWHM for each column as a row vector.<para></para>The default option "zero" computes fwhm at half maximum, i.e. 0.5*max(y). The option "min" computes fwhm at the middle curve, i.e. 0.5*(min(y)+max(y)). <para></para>The option "rlevel" computes full-width at the given relative level of peak profile<para></para>The option "alevel" computes full-width at the given absolute level of y.
+</para>
+</refsection>
+
+<refsection>
+ <title>Examples</title>
+ <programlisting role="example"><![CDATA[
+t=-50:0.01:50;
+y=(1/(2*sqrt(2*%pi)))*exp(-(t.^2)/8);
+z=fwhmjlt(y)
+//Expected Output
+//470.96442
+ ]]></programlisting>
+</refsection>
+
+
</refentry>
diff --git a/help/en_US/fwht.xml b/help/en_US/fwht.xml
index 4140453..4e0d8a6 100644
--- a/help/en_US/fwht.xml
+++ b/help/en_US/fwht.xml
@@ -17,7 +17,7 @@
<refnamediv>
<refname>fwht</refname>
- <refpurpose>Compute the Walsh-Hadamard transform of x using the Fast Walsh-Hadamard Transform (FWHT) algorithm</refpurpose>
+ <refpurpose>Compute the Walsh-Hadamard transform of x using the Fast Walsh-Hadamard Transform (FWHT) algorithm..</refpurpose>
</refnamediv>
diff --git a/help/en_US/helperHarmonicDistortion.xml b/help/en_US/helperHarmonicDistortion.xml
new file mode 100644
index 0000000..b49a559
--- /dev/null
+++ b/help/en_US/helperHarmonicDistortion.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ *
+ * This help file was generated from helperHarmonicDistortion.sci using help_from_sci().
+ *
+ -->
+
+<refentry version="5.0-subset Scilab" xml:id="helperHarmonicDistortion" xml:lang="en"
+ xmlns="http://docbook.org/ns/docbook"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns:ns3="http://www.w3.org/1999/xhtml"
+ xmlns:mml="http://www.w3.org/1998/Math/MathML"
+ xmlns:scilab="http://www.scilab.org"
+ xmlns:db="http://docbook.org/ns/docbook">
+
+ <refnamediv>
+ <refname>helperHarmonicDistortion</refname>
+ <refpurpose>helperHarmonicDistortionADC Helper function for HarmonicDistortionExample.m</refpurpose>
+ </refnamediv>
+
+
+<refsynopsisdiv>
+ <title>Calling Sequence</title>
+ <synopsis>
+ outputVoltage=helperHarmonicDistortion(inputVoltage)
+ </synopsis>
+</refsynopsisdiv>
+
+<refsection>
+ <title>Parameters</title>
+ <variablelist>
+ <varlistentry><term>inputVmax:</term>
+ <listitem><para> Maximum operating voltage times the sinusoidal signal.</para></listitem></varlistentry>
+
+ </variablelist>
+</refsection>
+
+<refsection>
+ <title>Description</title>
+ <para>
+Analizing the harmonic distortion of a weakly non-linear system in the presence of noise....
+</para>
+</refsection>
+
+<refsection>
+ <title>Examples</title>
+ <programlisting role="example"><![CDATA[
+VmaxPk = 2;
+Fi = 2000;
+Fs = 44.1e3;
+Tstop = 50e-3;
+t = 0:1/Fs:Tstop;
+inputVmax = VmaxPk*sin(2*%pi*Fi*t);
+outputVmax = helperHarmonicDistortion(inputVmax);
+plot(t, outputVmax)
+replot([0,-2.5,0.005,2.5])
+xlabel('Time')
+ylabel('Output Voltage')
+title('Amplifier output')
+ ]]></programlisting>
+ <scilab:image>
+ VmaxPk = 2;
+ Fi = 2000;
+ Fs = 44.1e3;
+ Tstop = 50e-3;
+ t = 0:1/Fs:Tstop;
+ inputVmax = VmaxPk*sin(2*%pi*Fi*t);
+ outputVmax = helperHarmonicDistortion(inputVmax);
+ plot(t, outputVmax)
+ replot([0,-2.5,0.005,2.5])
+ xlabel('Time')
+ ylabel('Output Voltage')
+ title('Amplifier output')
+ </scilab:image>
+
+</refsection>
+
+
+</refentry>
diff --git a/help/en_US/helperHarmonicDistortionAmplifier.xml b/help/en_US/helperHarmonicDistortionAmplifier.xml
deleted file mode 100644
index c58cc51..0000000
--- a/help/en_US/helperHarmonicDistortionAmplifier.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- *
- * This help file was generated from helperHarmonicDistortionAmplifier.sci using help_from_sci().
- *
- -->
-
-<refentry version="5.0-subset Scilab" xml:id="helperHarmonicDistortionAmplifier" xml:lang="en"
- xmlns="http://docbook.org/ns/docbook"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns:ns3="http://www.w3.org/1999/xhtml"
- xmlns:mml="http://www.w3.org/1998/Math/MathML"
- xmlns:scilab="http://www.scilab.org"
- xmlns:db="http://docbook.org/ns/docbook">
-
- <refnamediv>
- <refname>helperHarmonicDistortionAmplifier</refname>
- <refpurpose>helperHarmonicDistortionADC Helper function for HarmonicDistortionExample.m</refpurpose>
- </refnamediv>
-
-</refentry>
diff --git a/help/en_US/icceps.xml b/help/en_US/icceps.xml
index bd10adc..0cae986 100644
--- a/help/en_US/icceps.xml
+++ b/help/en_US/icceps.xml
@@ -20,4 +20,43 @@
<refpurpose>ICCEPS computes the inverse cepstrum of a real-valued input. This spectrum</refpurpose>
</refnamediv>
+<refsynopsisdiv>
+ <title>Calling Sequence</title>
+ <synopsis>
+ inv_ceps = icceps(xhat,remv_samp)
+ </synopsis>
+</refsynopsisdiv>
+
+<refsection>
+ <title>Parameters</title>
+ <variablelist>
+ <varlistentry><term>remv_samp:</term>
+ <listitem><para> Number of samples of delay to be removed </para></listitem></varlistentry>
+ <varlistentry><term>xhat:</term>
+ <listitem><para> real valued input </para></listitem></varlistentry>
+ <varlistentry><term>inv_ceps:</term>
+ <listitem><para> Inverse cepstrum output </para></listitem></varlistentry>
+ </variablelist>
+</refsection>
+
+<refsection>
+ <title>Description</title>
+ <para>
+inv_ceps = icceps(xhat,remv_samp) returns the inverse complex cepstrum of the real data sequence "xhat", removing "remv_samp" samples of delay. If "xhat" was obtained with cceps(x), then the amount of delay that was added to x was the element of round(unwrap(angle(fft(x)))/pi) corresponding to π radians.
+
+</para>
+</refsection>
+
+<refsection>
+ <title>Examples</title>
+ <programlisting role="example"><![CDATA[
+xhat=[ 2.2428 -0.0420 -0.0210 0.0045 0.0366 0.0788 0.1386 0.2327 0.4114 0.9249]
+icc = icceps(xhat,2);
+round(icc)
+//EXPECTED OUTPUT:
+// 2 3 4 5 6 7 8 9 10 1
+
+ ]]></programlisting>
+</refsection>
+
</refentry>
diff --git a/help/en_US/impz.xml b/help/en_US/impz.xml
index 3cde46f..197c5c8 100644
--- a/help/en_US/impz.xml
+++ b/help/en_US/impz.xml
@@ -17,7 +17,8 @@
<refnamediv>
<refname>impz</refname>
- <refpurpose></refpurpose>
+ <refpurpose> It gives Impulse response of digital filter
+</refpurpose>
</refnamediv>
@@ -31,4 +32,52 @@
[x_r, t_r] = impz(b, a, n, fs)
</synopsis>
</refsynopsisdiv>
+
+
+<refsection>
+ <title>Parameters</title>
+ <variablelist>
+ <varlistentry><term>x_r:</term>
+ <listitem><para> impz chooses the number of samples and returns the response in the column vector, x_r.</para></listitem></varlistentry>
+ <varlistentry><term>t_r:</term>
+ <listitem><para> impz returns the sample times in the column vector, t_r </para></listitem></varlistentry>
+ <varlistentry><term>b:</term>
+ <listitem><para> numerator coefficients of the filter</para></listitem></varlistentry>
+ <varlistentry><term>a:</term>
+ <listitem><para>denominator coefficients of the filter</para></listitem></varlistentry>
+ <varlistentry><term>n:</term>
+ <listitem><para> samples of the impulse response t(by default ,n = length(t) and is computed automatically.</para></listitem></varlistentry>
+ <varlistentry><term>fs:</term>
+ <listitem><para>sampling frequency</para></listitem></varlistentry>
+ </variablelist>
+</refsection>
+
+<refsection>
+ <title>Description</title>
+ <para>
+[x_r,t_r] = impz(b,a) returns the impulse response of the filter with numerator coefficients, b, and denominator coefficients, a. impz chooses the number of samples and returns the response in the column vector, x_r, and the sample times in the column vector, t_r. t_r = [0:n-1]' and n = length(t) is computed automatically.
+</para>
+</refsection>
+
+<refsection>
+ <title>Example 1</title>
+ <programlisting role="example"><![CDATA[
+[x_r,t_r]=impz([0 1 1],[1 -3 3 -1],10)
+//EXPECTED OUTPUT :
+// t_r = 0. 1. 2. 3. 4. 5. 6. 7. 8. 9
+// x_r= 0. 1. 4. 9. 16. 25. 36. 49 64 81
+
+ ]]></programlisting>
+</refsection>
+
+<refsection>
+ <title>Example 2</title>
+ <programlisting role="example"><![CDATA[
+[x_r,t_r]=impz(1,[1 1],5)
+//EXPECTED OUTPUT
+// t_r = 0. 1. 2. 3. 4
+//x_r = 1. - 1. 1. - 1. 1.
+ ]]></programlisting>
+</refsection>
+
</refentry>
diff --git a/help/en_US/impzlength.xml b/help/en_US/impzlength.xml
index 1b5adc8..6ed57fc 100644
--- a/help/en_US/impzlength.xml
+++ b/help/en_US/impzlength.xml
@@ -24,7 +24,31 @@
<refsynopsisdiv>
<title>Calling Sequence</title>
<synopsis>
- len = impzlength(b, a, tol)
+ len=impzlength(b,a)
+ len=impzlength(sos)
+ len=impzlength(b,a,tol)
+
+ </synopsis>
+</refsynopsisdiv>
+
+<refsection>
+ <title>Parameters</title>
+ <variablelist>
+ <varlistentry><term>b:</term>
+ <listitem><para>Numerator coefficients. real|complex - vector|scalar</para></listitem></varlistentry>
+ <varlistentry><term>a:</term>
+ <listitem><para> Denominator coefficients. real|complex - vector|scalar</para></listitem></varlistentry>
+ <varlistentry><term>sos:</term>
+ <listitem><para> Second order estimates. real|complex - matrix (K-by-6)</para></listitem></varlistentry>
+ <varlistentry><term>tol:</term>
+ <listitem><para> Tolerance for estimating the effective length of an IIR filter impulse response. scalar</para></listitem></varlistentry>
+ </variablelist>
+</refsection>
+
+<refsection>
+ <title>Description</title>
+ <para>
+len = impzlength(b, a, tol)
returns the impulse response length for the causal discrete-time filter
with the transfer function coefficients for numerator and denominator in
a and b respectively. For stable IIR filters, len is the effective length
@@ -39,23 +63,18 @@
specifies a tolerance for estimating the effective impulse response
length in case of an IIR filter. By default, tol is 5e-5. Increasing tol
leads to shorter len and vice-versa
-
- </synopsis>
-</refsynopsisdiv>
-
-<refsection>
- <title>Parameters</title>
- <variablelist>
- </variablelist>
+</para>
</refsection>
<refsection>
<title>Examples</title>
<programlisting role="example"><![CDATA[
-1) Low pass IIR filter with pole at 0.9
+//Low pass IIR filter with pole at 0.9
b = 1;
a = [1 -0.9];
len = impzlength(b,a);
+//Expected Output :
+//len=93
]]></programlisting>
</refsection>
@@ -63,7 +82,8 @@ len = impzlength(b,a);
<refsection>
<title>See also</title>
<simplelist type="inline">
- <member><link linkend="designfilt">| digitalFilter | impz | zp2sos</link></member>
+ <member><link linkend="impz"></link></member><para></para>
+ <member><link linkend="zp2sos"></link></member><para></para>
</simplelist>
</refsection>
diff --git a/help/en_US/intfilt.xml b/help/en_US/intfilt.xml
index a674813..29c93f6 100644
--- a/help/en_US/intfilt.xml
+++ b/help/en_US/intfilt.xml
@@ -17,7 +17,63 @@
<refnamediv>
<refname>intfilt</refname>
- <refpurpose></refpurpose>
+ <refpurpose>The "intfilt" function estimate Interpolated FIR Filter Design</refpurpose>
</refnamediv>
+<refsynopsisdiv>
+ <title>Calling Sequence</title>
+ <synopsis>
+ h=intfilt(R,L,freqmult)
+ [h a]=intfilt(R,L,freqmult)
+
+ </synopsis>
+</refsynopsisdiv>
+
+<refsection>
+ <title>Parameters</title>
+ <variablelist>
+ <varlistentry><term>R:</term>
+ <listitem><para> Samples. It should be numeric</para></listitem></varlistentry>
+ <varlistentry><term>L:</term>
+ <listitem><para> bandlimited interpolation samples. It must be nonzero.</para></listitem></varlistentry>
+ <varlistentry><term>freqmult:</term>
+ <listitem><para> bandlimitedness of ALPHA times the Nyquist frequency. It can be numeric or character ('B' or 'L', B is length (N+1)*L-1 for N odd and (N+1)*L for N even) </para></listitem></varlistentry>
+
+ </variablelist>
+</refsection>
+
+<refsection>
+ <title>Description</title>
+ <para>
+"h=intfilt(R,L,freqmult)" designs a linear phase FIR filter. This function does ideal bandlimited interpolation using the nearest 2*L nonzero samples, when used on a sequence inserted with l-1 consecutive zeros between every l samples. It assumes an original bandlimitedness of "freqmult" times the Nyquist frequency.
+</para>
+</refsection>
+
+<refsection>
+ <title>Example 1</title>
+ <programlisting role="example"><![CDATA[
+h1=intfilt(2,3,'l');
+//EXPECTED OUTPUT :
+// -0.0625 0. 0.5625 1. 0.5625 0. -0.0625
+
+ ]]></programlisting>
+</refsection>
+
+<refsection>
+ <title>Example 2</title>
+ <programlisting role="example"><![CDATA[
+h1=intfilt(4,1,1);
+//EXPECTED OUTPUT :
+// 0.3001054 0.6366198 0.9003163 1. 0.9003163 0.6366198 0.3001054
+
+ ]]></programlisting>
+</refsection>
+
+<refsection>
+ <title>Authors</title>
+ <simplelist type="vert">
+ <member>Jitendra Singh</member>
+ </simplelist>
+</refsection>
+
</refentry>
diff --git a/help/en_US/is2rc.xml b/help/en_US/is2rc.xml
index 8f1bd14..0da550b 100644
--- a/help/en_US/is2rc.xml
+++ b/help/en_US/is2rc.xml
@@ -25,7 +25,7 @@
<title>Calling Sequence</title>
<synopsis>
K = is2rc(isin)
-
+
</synopsis>
</refsynopsisdiv>
@@ -42,28 +42,40 @@
<refsection>
<title>Description</title>
<para>
-This function returns a vector of reflection coefficients from a vector of inverse sine parameters
-output array has k(i) = sin(pi/2*isin(i))
- </para>
- <para>
-Example
-k = [0.3090 0.9801 0.0031 0.0082 -0.0082];
-isin = rc2is(k) //Gives inverse sine parameters
-k_dash = is2rc(isin)
+This function returns a vector of reflection coefficients from a vector of inverse sine parameters.<para></para>output array has k(i) = sin(pi/2*isin(i))
+
</para>
<para>
</para>
</refsection>
<refsection>
+ <title>Example 1</title>
+ <programlisting role="example"><![CDATA[
+ k = [0.3090 0.9801 0.0031 0.0082 -0.0082];
+ isin = rc2is(k) //Gives inverse sine parameters
+ k_dash = is2rc(isin)
+// EXPECTED OUTPUT :
+//isin = [0.1999886 0.8727832 0.0019735 0.0052203 -0.0052203 ]
+//k_dash =[0.309 0.9801 0.0031 0.0082 - 0.0082]
+ ]]></programlisting>
+</refsection>
+
+<refsection>
<title>See also</title>
<simplelist type="inline">
<member><link linkend="rc2is">rc2is</link></member>
<member><link linkend="rc2poly">rc2poly</link></member>
<member><link linkend="rc2ac">rc2ac</link></member>
<member><link linkend="rc2lar">rc2lar</link></member>
- <member><link linkend="Author">Author</link></member>
- <member><link linkend="Parthe">Pandit</link></member>
+
+ </simplelist>
+</refsection>
+
+<refsection>
+ <title>Authors</title>
+ <simplelist type="vert">
+ <member>Parthe Pandit</member>
</simplelist>
</refsection>
diff --git a/help/en_US/isallpass.xml b/help/en_US/isallpass.xml
index b519d07..4dbf9ab 100644
--- a/help/en_US/isallpass.xml
+++ b/help/en_US/isallpass.xml
@@ -17,7 +17,77 @@
<refnamediv>
<refname>isallpass</refname>
- <refpurpose>[nargout,nargin]=argn();</refpurpose>
+ <refpurpose>Determines whether the filter is allpass or not</refpurpose>
</refnamediv>
+<refsynopsisdiv>
+ <title>Calling Sequence</title>
+ <synopsis>
+ flag = isallpass(b,a)
+ flag = isallpass(sos)
+ flag = isallpass(...,tol)
+
+ </synopsis>
+</refsynopsisdiv>
+
+<refsection>
+ <title>Parameters</title>
+ <variablelist>
+ <varlistentry><term>b:</term>
+ <listitem><para>vector containing zero coefficients of the transfer function</para></listitem></varlistentry>
+ <varlistentry><term>a:</term>
+ <listitem><para> vector containing pole coefficients of the transfer functtion</para></listitem></varlistentry>
+ <varlistentry><term>sos:</term>
+ <listitem><para> Second order estimates. real|complex - matrix (K-by-6)</para></listitem></varlistentry>
+ <varlistentry><term>tol:</term>
+ <listitem><para> tolerance is used to determine when two numbers are close enough to be considered equal. scalar</para></listitem></varlistentry>
+ </variablelist>
+</refsection>
+
+<refsection>
+ <title>Description</title>
+ <para>
+flag = isallpass(b,a) returns a logical output that is either 1 or 0 depending on output parameter "flag" by the filter specified by numerator coefficients, b, and denominator coefficients, a, is an allpass filter or not. If the filter is not an allpass filter, flag is equal to false.<para></para>flag = isallpass(sos) returns true if the filter specified by second order sections matrix ie sos, is an allpass filter.<para></para> sos is a K-by-6 matrix, where the number of sections, K, must be greater than or equal to 2. Each row of sos corresponds to the coefficients of a second order (biquad) filter. The ith row of the sos matrix corresponds to [bi(1) bi(2) bi(3) ai(1) ai(2) ai(3)].
+</para>
+</refsection>
+
+<refsection>
+ <title>Example 1</title>
+ <programlisting role="example"><![CDATA[
+k = [1/2 1/3 1/4 1/5];
+[b,a] = latc2tf(k,'allpass');
+flag_isallpass = isallpass(b,a)
+//Expected Output
+//flag_isallpass =1
+ ]]></programlisting>
+</refsection>
+
+<refsection>
+ <title>Example 2</title>
+ <programlisting role="example"><![CDATA[
+b = [1/3 1/4 1/5 1];
+a=b($:-1:1);
+flag = isallpass(b,a)
+//Expected Output
+//flag = 1
+ ]]></programlisting>
+</refsection>
+
+<refsection>
+ <title>Example 3</title>
+ <programlisting role="example"><![CDATA[
+
+flag = isallpass(1,[1 1])
+//Expected Output
+//flag = 0
+ ]]></programlisting>
+</refsection>
+
+<refsection>
+ <title>Authors</title>
+ <simplelist type="vert">
+ <member>Parthasarathi Panda</member>
+ </simplelist>
+</refsection>
+
</refentry>
diff --git a/help/en_US/interp.xml b/help/en_US/oct_interp.xml
index ec22cbc..48146ea 100644
--- a/help/en_US/interp.xml
+++ b/help/en_US/oct_interp.xml
@@ -2,11 +2,11 @@
<!--
*
- * This help file was generated from interp.sci using help_from_sci().
+ * This help file was generated from oct_interp.sci using help_from_sci().
*
-->
-<refentry version="5.0-subset Scilab" xml:id="interp" xml:lang="en"
+<refentry version="5.0-subset Scilab" xml:id="oct_interp" xml:lang="en"
xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:svg="http://www.w3.org/2000/svg"
@@ -16,7 +16,7 @@
xmlns:db="http://docbook.org/ns/docbook">
<refnamediv>
- <refname>interp</refname>
+ <refname>oct_interp</refname>
<refpurpose>function y = interp(x, q, n, Wc)</refpurpose>
</refnamediv>
diff --git a/macros/armcov.sci b/macros/armcov.sci
index 0c5158c..e36b4c7 100644
--- a/macros/armcov.sci
+++ b/macros/armcov.sci
@@ -1,22 +1,41 @@
-function [ar_coeff, var_est] = armcov(data_in, order)
-
- checkNArgin(2,2, argn(2));
+//Autoregressive all-pole model parameters — modified covariance method
+//Calling Sequence-
+//a = armcov(x,p)
+//[a,e] = armcov(x,p)
+//Parameters
+//x:input signal
+//p:order
+//a:output of an AR system driven by white noise
+//e:variance estimate
+//Description
+//This function uses the modified covariance method to fit a pth-order autoregressive (AR) model to the input signal x.
+
+//Example :
+//A = [1 -2.7607 3.8106 -2.6535 0.9238];
+//y = filter(1,A,0.2*rand(1024,1,"normal"));
+//arcoeffs = armcov(y,4)
+//OUTPUT : // since "rand" function is used, output doesn't always remains same. It differs by some amount.
+// 1. - 2.7450144 3.7762385 - 2.6201362 0.9104109 0.9104109
+
+ function [ar_coeff, var_est] = armcov(data_in, order)
+
+ checkNArgin(2,2, argn(2)); // function call
method = 'modified';
[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')
+ error('Not enough input arguments') // Number of input arguments should be greater than min_argin
end
-
+
if num_of_argin > max_argin then
- error('Too many input arguments')
+ error('Too many input arguments') // Number of input arguments should be lesserr than max_argin
end
-
+
endfunction
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
diff --git a/macros/blackmanharris.sci b/macros/blackmanharris.sci
index f2affdf..faec39a 100644
--- a/macros/blackmanharris.sci
+++ b/macros/blackmanharris.sci
@@ -1,35 +1,38 @@
function w = blackmanharris (m, opt)
-//This function returns the filter coefficients of a Blackman-Harris window.
-//Calling Sequence
-//w = blackmanharris (m)
-//w = blackmanharris (m, opt)
-//Parameters
-//m: positive integer value
-//opt: string value, takes "periodic" or "symmetric"
-//w: output variable, vector of real numbers
-//Description
-//This is an Octave function.
-//This function returns the filter coefficients of a Blackman-Harris window of length m supplied as input, to the output vector w.
-//The second parameter can take the values "periodic" or "symmetric", depending on which the corresponding form of window is returned. The default is symmetric.
-//Examples
-//blackmanharris(5,"periodic")
-//ans =
-// 0.00006
-// 0.1030115
-// 0.7938335
-// 0.7938335
-// 0.1030115
-
-rhs = argn(2)
-if(rhs<1 | rhs>2)
-error("Wrong number of input arguments.")
-end
- select(rhs)
- case 1 then
- w = callOctave("blackmanharris",m)
- case 2 then
- w = callOctave("blackmanharris",m,opt)
- end
-endfunction
+ funcprot(0);
+ rhs= argn(2);
+
+ if (rhs < 1 | rhs > 2)
+ error("Wrong Number of input arguments");
+ end
+
+ if (~ (isscalar (m) & (m == fix (m)) & (m > 0)))
+ error ("blackmanharris: M must be a positive integer");
+ end
+
+ N = m - 1;
+ if (rhs == 2)
+ select (opt)
+ case "periodic"
+ N = m;
+ case "symmetric"
+ N = m-1;
+ else
+ error ("blackmanharris: window type must be either periodic or symmetric");
+ end
+ end
+
+ if (m == 1)
+ w = 1;
+ else
+ a0 = 0.35875;
+ a1 = 0.48829;
+ a2 = 0.14128;
+ a3 = 0.01168;
+ n = [0:m-1]';
+ w = a0 - a1.*cos(2.*%pi.*n./N) + a2.*cos(4.*%pi.*n./N) - a3.*cos(6.*%pi.*n./N);
+ end
+
+endfunction
diff --git a/macros/blackmannuttall.sci b/macros/blackmannuttall.sci
index 29dd1b0..674afe9 100644
--- a/macros/blackmannuttall.sci
+++ b/macros/blackmannuttall.sci
@@ -1,34 +1,64 @@
-function [w] = blackmannuttall (m, opt)
+//function [w] = blackmannuttall (m, opt)
//This function returns the filter coefficients of a Blackman-Nuttall window.
//Calling Sequence
//w = blackmannuttall (m)
//w = blackmannuttall (m, opt)
-//Parameters
+//Parameters
//m: positive integer value
//opt: string value, takes "periodic" or "symmetric"
//w: output variable, vector of real numbers
-//Description.
+//Description.
//This is an Octave function.
-//This function returns the filter coefficients of a Blackman-Nuttall window of length m supplied as input, to the output vector w.
-//The second parameter can take the values "periodic" or "symmetric", depending on which the corresponding form of window is returned. The default is symmetric.
+//This function returns the filter coefficients of a Blackman-Nuttall window of length m supplied as input, to the output vector w.
+//The second parameter can take the values "periodic" or "symmetric", depending on which the corresponding form of window is returned. The default is symmetric.
//Examples
//blackmannuttall(5,"symmetric")
//ans =
-// 0.0003628
-// 0.2269824
-// 1.
-// 0.2269824
-// 0.0003628
-rhs = argn(2)
-
-if (rhs<1 | rhs>2)
-error("Wrong number of input arguments.")
-end
- select (rhs)
- case 1 then
- w = callOctave("blackmannuttall",m)
- case 2 then
- w = callOctave("blackmannuttall",m,opt)
- end
-endfunction
+// 0.0003628
+// 0.2269824
+// 1.
+// 0.2269824
+// 0.0003628
+
+
+
+
+function w = blackmannuttall (m, opt)
+
+ funcprot(0);
+ rhs= argn(2);
+ if (rhs < 1 | rhs > 2)
+ error("Wrong Number of input arguments");
+ end
+
+ if (~ (isscalar (m) & (m == fix (m)) & (m > 0)))
+ error ("blackmannuttall: M must be a positive integer");
+ end
+
+ N = m - 1;
+ if (rhs == 2)
+ select (opt)
+ case "periodic"
+ N = m;
+ case "symmetric"
+ N = m-1;
+ else
+ error ('nuttallwin: window type must be either periodic or symmetric");
+ end
+ end
+
+ if (m == 1)
+ w = 1;
+ else
+ a0 = 0.3635819;
+ a1 = 0.4891775;
+ a2 = 0.1365995;
+ a3 = 0.0106411;
+// n = [-N/2:(m-1)/2]';
+// w = a0 + a1.*cos(2.*%pi.*n./N) + a2.*cos(4.*%pi.*n./N) + a3.*cos(6.*%pi.*n./N);
+ n=[0:m-1]'
+ w = a0 - a1.*cos(2.*%pi.*n./N) + a2.*cos(4.*%pi.*n./N) - a3.*cos(6.*%pi.*n./N);
+ end
+
+endfunction
diff --git a/macros/bohmanwin.sci b/macros/bohmanwin.sci
index 183637c..8f391c8 100644
--- a/macros/bohmanwin.sci
+++ b/macros/bohmanwin.sci
@@ -1,27 +1,26 @@
-function y = bohmanwin (m)
-//This function returns the filter coefficients of a Bohman window.
-//Calling Sequence
-//y = bohmanwin (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 Bohman window of length m supplied as input, to the output vector y.
-//Examples
-//bohmanwin(4)
-//ans =
-// 0.
-// 0.6089978
-// 0.6089978
-// 0.
+function w = bohmanwin (m)
-rhs = argn(2)
+ funcprot(0);
+ rhs= argn(2);
-if(rhs~=1)
-error("Wrong number of input arguments.")
-end
+ if (rhs ~= 1)
+ error("Wrong Number of input arguments");
+ end
-y = callOctave("bohmanwin",m)
+ if (~ (isscalar (m) & (m == fix (m)) & (m > 0)))
+ error ("bohmanwin: M must be a positive integer");
+ end
-endfunction
+ if (m == 1)
+ w = 1;
+ else
+ N = m - 1;
+ n = -N/2:N/2;
+
+ w = (1-2.*abs(n)./N).*cos(2*%pi.*abs(n)./N) + (1/%pi).*sin(2*%pi.*abs(n)./N);
+ w(1) = 0;
+ w(length(w))=0;
+ w = w';
+ end
+
+endfunction
diff --git a/macros/boxcar.sci b/macros/boxcar.sci
index 120c6e9..e0aace6 100644
--- a/macros/boxcar.sci
+++ b/macros/boxcar.sci
@@ -1,28 +1,16 @@
-function [y] = boxcar (m)
-//This function returns the filter coefficients of a rectangular window.
-//Calling Sequence
-//y = boxcar (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 rectangular window of length m supplied as input, to the output vector y.
-//Examples
-//boxcar(6)
-//ans =
-// 1.
-// 1.
-// 1.
-// 1.
-// 1.
-// 1.
+function w = boxcar (m)
-rhs = argn(2)
-if(rhs~=1)
-error("Wrong number of input arguments.")
-end
+ funcprot(0);
+ rhs= argn(2);
-y = callOctave("boxcar",m)
+ if (rhs ~= 1)
+ error("Wrong Number of input arguments");
+ end
+
+ if (~ (isscalar (m) & (m == fix (m)) & (m > 0)))
+ error ("boxcar: M must be a positive integer");
+ end
+
+ w=ones(m,1);
endfunction
diff --git a/macros/cconv.sci b/macros/cconv.sci
index c7560ef..d3c2c2f 100644
--- a/macros/cconv.sci
+++ b/macros/cconv.sci
@@ -1,12 +1,40 @@
//Author: Parthasarathi Panda
//parthasarathipanda314@gmail.com
function o=cconv(a,b,n)
+
+ // circularly convolves vectors a and b. n is the length of the resulting vector.
+ //If you omit n, it defaults to length(a)+length(b)-1. When n = length(a)+length(b)-1,
+ //the circular convolution is equivalent to the linear convolution computed with conv
+ //Calling Sequence:
+ //o=cconv(a,b)
+ //o = cconv(a,b,n)
+//a =a real or complex vector.
+//b =a real or complex vector.
+//n =length of circular convolution
+//o =convolution sequence
+//Examples:
+//a=[1 2 3]
+//b=[4 5 6]
+//o=cconv(a,b,3)
+//Output: o= 31. 31. 28.
+//
+//
+//a=[1 2+%i 4]
+//b=[2 3*%i 5]
+//o=cconv(a,b)
+//o=clean(o)
+//
+//Output: o= 2. 4. + 5.i 10. + 6.i 10. + 17.i 20.
+//
+
+
+
[nargout,nargin]=argn();
- if nargin==2 then
- n=length(a)+length(b)-1;
+ if nargin==2 then //to check the number of inputs entered by the user
+ n=length(a)+length(b)-1;//setting the length of convolution
end
- if type(a)~=1 | type(b)~=1 | type(n)~=1 then
- error('check the data type of input'); //to check if the inputs are real/complex arrays
+ if type(a)~=1 | type(b)~=1 | type(n)~=1 then//to check if the inputs are real/complex arrays
+ error('check the data type of input');
end
if size(n)~=[1,1] then
error('check the data type of input'); //to check that n is single dimensional
@@ -18,27 +46,27 @@ function o=cconv(a,b,n)
[i,j]=size(a);
if j~=1 & i~=1 then
error('a should be a vector');
- elseif j==1
+ elseif j==1 //if a column vector make it a row vector
a=a';
end
//checking if b is a 1d vector(row or column) and turning it into row vector
[i,j]=size(b);
if j~=1 & i~=1 then
error('b should be a vector');
- elseif j==1
+ elseif j==1//if a column vector make it a row vector
b=b';
end
-
+
//adjusting length of a
- if n<=length(a) then
+ if n<=length(a) then//if length exceeds n,then take only first n-samples
a=a(1:n);
- else
+ else//if length is less than n, then pad zeroes
a=[a,zeros(1,n-length(a))]
end
//adjusting length of b
- if n<=length(b) then
+ if n<=length(b) then//if length exceeds n,then take only first n-samples
b=b(1:n);
- else
+ else//if length is less than n, then pad zeroes
b=[b,zeros(1,n-length(b))]
end
//computing ffts (for speed)
@@ -46,5 +74,5 @@ function o=cconv(a,b,n)
bft=fft(b);
//circular convolution dft is the product of dft of the 2
oft=aft.*bft;
- o=ifft(oft);
+ o=ifft(oft); //inverse gives circular covolution
endfunction
diff --git a/macros/cheb.sci b/macros/cheb.sci
index db2df85..1ebf3a0 100644
--- a/macros/cheb.sci
+++ b/macros/cheb.sci
@@ -1,34 +1,33 @@
-function res = cheb (n, x)
-//Calculates the nth-order Chebyshev polynomial at the point x.
-//Calling Sequence
-//cheb(n, x)
-//Parameters
-//n: Filter order
-//x: Point at which the Chebyshev polynomial is calculater.
-//Description
-//This is an Octave function.
-//Equation for Chebyshev polynomial is
-// / cos(n acos(x), |x| <= 1
-// Tn(x) = |
-// \ cosh(n acosh(x), |x| > 1
-//
-//x can also be a vector. In that case the output will also be a vector of same size as x.
-//Examples
-//x = [1 2 3 4]
-// cheb(10, x)
-//ans =
-//
-// 1.0000e+00 2.6209e+05 2.2620e+07 4.5747e+08
+function T = cheb (n, x)
-funcprot(0);
-rhs = argn(2)
-if (rhs < 2 | rhs > 2)
-error("Wrong number of input arguments.")
-end
+ funcprot(0);
+ rhs= argn(2);
+
+ if (rhs ~= 2)
+ error("Wrong Number of input arguments");
+ elseif (~(isscalar (n) & (n == round(n)) & (n >= 0)))
+ error ("cheb: n has to be a positive integer");
+ end
+
+ if (max(size(x)) == 0)
+ T = [];
+ end
+ // avoid resizing latencies
+ T = zeros(size(x));
+ ind = (abs (x) <= 1);
+ if (max(size(ind)))
+ T(ind) = cos(n*acos(x(ind)));
+ end
+
+ ind = abs (x) > 1;
+ if (max(size(ind)))
+ T(ind) = cosh(n*acosh(x(ind)));
+ end
+
+ T = real(T);
+
+ if(size(x)==[1 1])
+ T=T(1);
+ end
-select(rhs)
-
- case 2 then
- res = callOctave("cheb",n,x)
- end
endfunction
diff --git a/macros/chebwin.sci b/macros/chebwin.sci
index 781bb6e..2caeecd 100644
--- a/macros/chebwin.sci
+++ b/macros/chebwin.sci
@@ -1,37 +1,43 @@
function w = chebwin (m, at)
-//This function returns the filter coefficients of a Dolph-Chebyshev window.
-//Calling Sequence
-//w = chebwin (m)
-//w = chebwin (m, at)
-//Parameters
-//m: positive integer value
-//at: real scalar value
-//w: output variable, vector of real numbers
-//Description
-//This is an Octave function.
-//This function returns the filter coefficients of a Dolph-Chebyshev window of length m supplied as input, to the output vector w.
-//The second parameter is the stop band attenuation of the Fourier transform in dB. The default value is 100 dB.
-//Examples
-//chebwin(7)
-//ans =
-// 0.0565041
-// 0.3166085
-// 0.7601208
-// 1.
-// 0.7601208
-// 0.3166085
-// 0.0565041
-rhs = argn(2)
-if(rhs<1 | rhs>2)
-error("Wrong number of input arguments.")
-end
-select(rhs)
-case 1 then
-w = callOctave("chebwin",m)
-case 2 then
-w = callOctave("chebwin",m,at)
-end
-endfunction
+ funcprot(0);
+ rhs= argn(2);
+
+ if (rhs < 1 | rhs > 2)
+ error("Wrong Number of input arguments");
+ elseif (~ (isscalar (m) & (m == fix (m)) & (m > 0)))
+ error ("chebwin: M must be a positive integer");
+ elseif (rhs == 1)
+ at = 100;
+ elseif (~ (isscalar (at) & isreal(at)))
+ error ("chebwin: AT must be a real scalar");
+ end
+ if (m == 1)
+ w = 1;
+ else
+ // beta calculation
+ gamma = 10^(-at/20);
+ beta = cosh(1/(m-1) * acosh(1/gamma));
+ // freq. scale
+ k = (0:m-1);
+ x = beta*cos(%pi*k/m);
+ // Chebyshev window (freq. domain)
+ p = cheb(m-1, x);
+ // inverse Fourier transform
+ if (modulo(m,2))
+ w = real(fft(p));
+ M = (m+1)/2;
+ w = w(1:M)/w(1);
+ w = [w(M:-1:2) w]';
+ else
+ //half-sample delay (even order)
+ p = p.*exp(%i*%pi/m * (0:m-1));
+ w = real(fft(p));
+ M = m/2+1;
+ w = w/w(2);
+ w = [w(M:-1:2) w(2:M)]';
+ end
+ end
+endfunction
diff --git a/macros/check.sci b/macros/check.sci
index c7a1678..a52db3c 100644
--- a/macros/check.sci
+++ b/macros/check.sci
@@ -1,4 +1,11 @@
function [s] = check(str)
+//It checks whether the input string is equal to "AKICc". If it is equal, then it results T(True) else it returns F(False)
+//s: output variable
+//str: Input string
+//Example:
+//check("apple")
+//output:
+//F
funcprot(0);
is_AKICc = (str == "AKICc")
disp(is_AKICc)
diff --git a/macros/cummax.sci b/macros/cummax.sci
index 672dc5c..e9a68e5 100644
--- a/macros/cummax.sci
+++ b/macros/cummax.sci
@@ -13,10 +13,10 @@ function M = cummax(varargin)
// direction specifies as the direction of operation
//
// Parameters
- // A - real|complex numbers - vector|matrix
- // Input Array
- // For complex elements, cummax compares the magnitude of elements. If
- // the magnitude are same, phase angles are compared.
+// A - real|complex numbers - vector|matrix
+// Input Array
+// For complex elements, cummax compares the magnitude of elements. If
+// the magnitude are same, phase angles are compared.
// dim - positive integer - scalar
// Dimension to operate along
// If no dimension is specified, then the default value is the first
@@ -31,7 +31,7 @@ function M = cummax(varargin)
// v = [8 9 1 10 6 1 3 6 10 10]
// M = cummax(v)
//
- // Expected output: [8 8 1 1 1 1 1 1 1 1]
+ // Expected output: [8 9 9 10 10 10 10 10 10 10]
//
// Authors
// Ayush Baid
diff --git a/macros/decimate.sci b/macros/decimate.sci
index 5a2e428..9f8aeb5 100644
--- a/macros/decimate.sci
+++ b/macros/decimate.sci
@@ -1,14 +1,47 @@
function y = decimate(x, q, n, ftype)
+//Decimation — decrease sample rate by integer factor
+
+//Calling Sequence
+//y = decimate(x,q)
+//y = decimate(x,q,n)
+// y = decimate (…, "fir")
+
+//Parameters
+//x: input sequence
+//q: reduction factor
+//n : filter order
+//ftype: filter type : iir or fir
+
+//Description
+//this is an octave function
+//y = decimate(x,q) reduces the sample rate of x, the input signal, by a factor of q.
+//By default, an order n Chebyshev type I filter is used. If n is not specified, the default is 8.
+//If the optional argument "fir" is given, an order n FIR filter is used, with a default order of 30 if n is not given.
+//Note that q must be an integer for this rate change method.
+//
+//Example :
+//t = 0:.00025:1;
+//x = sin(2*%pi*30*t) + sin(2*%pi*60*t);
+//y = decimate(x,4);
+//subplot(211);
+//plot2d3((0:120),x(1:121));
+//subplot(212);
+//plot2d3((0:30),y(1:31));
+
+//This will result in plots of original sequence v/s sample number and decimated sequence v/s sample number
+
rhs = argn(2)
if(rhs<2 | rhs>4)
error("Wrong number of input arguments.")
elseif(~(sum(length(q)==1) & q == fix (q) & q > 0))
error("Parameter 2 must be a positive integer.")
end
-if (nargin < 3)
+//if (nargin < 3)
+if(argn(2) < 3)
ftype = "iir"
n = []
-elseif (nargin < 4)
+//elseif (nargin < 4)
+elseif(argn(2) < 4)
if (ischar (n))
ftype = n
n = []
@@ -17,7 +50,8 @@ ftype = "iir"
end
end
-if (~ and(strcmp (ftype, {"fir", "iir"})))
+//if (~ and(strcmp (ftype, {"fir", "iir"}))) // if strings are equal strcmp returns 0
+if(strcmp(ftype,"iir") & strcmp(ftype,"fir"))
error("Filter type must be either fir or iir.")
end
@@ -42,6 +76,3 @@ case 4 then
y = callOctave("decimate", x, q, n, ftype)
end
endfunction
-
-
-
diff --git a/macros/filtfilt.sci b/macros/filtfilt.sci
index f263da6..7f86113 100644
--- a/macros/filtfilt.sci
+++ b/macros/filtfilt.sci
@@ -11,8 +11,8 @@ function [y]=filtfilt(b,a,x)
// This is an Octave function
// In theory, it forwards and reverse filters the signal and corrects phase distortion upto an extent by a one-pass filter but squares the magnitude response in the process. Practically though, the correction isn't perfect and magnitude response, particularly the stop band is distorted.
// Examples
-// 1. [a,b]=filtfilt (1,2i,[i -4 0])
-// a = [0.00000 - 0.25000i 1.00000 + 0.00000i 0.00000 + 0.00000i]
+// 1. y=filtfilt (1,2*%i,[%i -4 0]) // Number of Output argument should be equal to 1
+// y = [-0.25i 1 0]
funcprot(0);
rhs=argn(2);
diff --git a/macros/filtic.sci b/macros/filtic.sci
index 3fd919a..efd48ba 100644
--- a/macros/filtic.sci
+++ b/macros/filtic.sci
@@ -13,7 +13,7 @@ function zf = filtic (b, a, y, x)
//This function finds the initial conditions for the delays in the transposed direct-form II filter implementation.
//The vectors b and a represent the numerator and denominator coefficients of the filter's transfer function.
//Examples
-//filtic([i,1,-i,5], [1,2,3i], [0.8i,7,9])
+//filtic([%i,1,-%i,5], [1,2,3*%i], [0.8*%i,7,9])
//ans =
// 0.00000 - 22.60000i
// 2.40000 + 0.00000i
@@ -34,4 +34,3 @@ case 4 then
zf = callOctave("filtic",b,a,y,x)
end
endfunction
-
diff --git a/macros/fir1.sci b/macros/fir1.sci
index 70c95b7..05532db 100644
--- a/macros/fir1.sci
+++ b/macros/fir1.sci
@@ -1,39 +1,114 @@
-function B = fir1(N, W, varargin)
-//Produce an order N FIR filter with the given frequency cutoff, returning the N+1 filter coefficients in B.
-//Calling Sequence
-//B = fir1(N, W)
-//B = fir1(N, W, TYPE)
-//B = fir1(N, W, TYPE, WINDOW)
-//B = fir1(N, W, TYPE, WINDOW, NOSCALE)
-//Parameters
-//N: Integer
-//W: Integer or Vector
-//Description
-// Produce an order N FIR filter with the given frequency cutoff W, returning the N+1 filter coefficients in B. If W is a scalar, it specifies the frequency cutoff for a lowpass or highpass filter. If W is a two-element vector, the two values specify the edges of a bandpass or bandstop filter. If W is an N-element vector, each value specifies a band edge of a multiband pass/stop filter.
-//
-//The filter TYPE can be specified with one of the following strings: "low", "high", "stop", "pass", "bandpass", "DC-0", or "DC-1". The default is "low" is W is a scalar, "pass" if W is a pair, or "DC-0" if W is a vector with more than 2 elements.
-//
-//An optional shaping WINDOW can be given as a vector with length N+1. If not specified, a Hamming window of length N+1 is used.
-//
-//With the option "noscale", the filter coefficients are not normalized. The default is to normalize the filter such that the magnitude response of the center of the first passband is 1.
-//Examples
-// fir1 (5, 0.4)
-//ans =
-// 9.2762e-05 9.5482e-02 4.0443e-01 4.0443e-01 9.5482e-02 9.2762e-05
-funcprot(0);
-rhs = argn(2);
-if(rhs<2 | rhs>5)
-error("Wrong number of input arguments.");
+function b = fir1(n, w, varargin)
+
+ funcprot(0);
+ if argn(2) < 2 | argn(2) > 5
+ error("Wrong Number of input arguments");
+ end
+
+ // Assign default window, filter type and scale.
+ // If single band edge, the first band defaults to a pass band to
+ // create a lowpass filter. If multiple band edges, the first band
+ // defaults to a stop band so that the two band case defaults to a
+ // band pass filter. Ick.
+
+ window_in = [];
+ scale = 1;
+ ftype = bool2s(length(w)==1);
+
+
+ for i=1:length(varargin)
+ arg = varargin(i);
+ if (type(arg)==10)
+ arg=convstr(arg,"l");
+ end
+ if isempty(arg)
+ continue;
+ end
+
+ select arg
+ case 'low' then ftype = 1; case 'stop' then ftype = 1; case 'dc-1' then ftype = 1;
+ case 'high' then ftype = 0; case 'pass' then ftype = 0; case 'bandpass' then ftype = 0; case 'dc-0' then ftype = 0;
+ case 'scale' then scale=1;
+ case 'noscale' then scale=0;
+ else window_in=arg;
+ end
+ end
+
+ // build response function according to fir2 requirements
+ bands = length(w)+1;
+ f = zeros(1,2*bands);
+ f(2*bands)=1;
+ f(2:2:2*bands-1) = w;
+ f(3:2:2*bands-1) = w;
+ m = zeros(1,2*bands);
+ m(1:2:2*bands) = modulo([1:bands]-(1-ftype),2);
+ m(2:2:2*bands) = m(1:2:2*bands);
+
+
+
+
+ //Increment the order if the final band is a pass band. Something
+ // about having a nyquist frequency of zero causing problems.
+ //
+ if modulo(n,2)==1 & m(2*bands)==1,
+ warning("n must be even for highpass and bandstop filters. Incrementing.");
+ n = n+1;
+ if isvector(window_in) & isreal(window_in) & ~(type(window_in)==10)
+ // Extend the window using interpolation
+ M = length(window_in);
+ if M == 1,
+ window_in = [window_in; window_in];
+ elseif M < 4
+ window_in = interp1(linspace(0,1,M),window_in,linspace(0,1,M+1),'linear');
+ else
+ window_in = interp1(linspace(0,1,M),window_in,linspace(0,1,M+1),'spline');
+ end
+ end
+ end
+
+ // compute the filter
+ b = fir2(n, f, m, [], 2, window_in);
+
+ // normalize filter magnitude
+ if scale == 1
+ // find the middle of the first band edge
+ // find the frequency of the normalizing gain
+ if m(1) == 1
+ // if the first band is a passband, use DC gain
+ w_o = 0;
+ elseif f(4) == 1
+ // for a highpass filter,
+ // use the gain at half the sample frequency
+ w_o = 1;
+ else
+ // otherwise, use the gain at the center
+ // frequency of the first passband
+ w_o = f(3) + (f(4)-f(3))/2;
+ end
+
+ // compute |h(w_o)|^-1
+
+ if ~(isvector(b) | isempty(b)) // Check input is a vector
+ error('Invalid');
+ end
+
+ x=exp(-1*%i*%pi*w_o)
+// z=[1 -exp(-1*%i*%pi*w_o)];
+ disp(x)
+ nc = length(b);
+ if(isscalar(x) & nc>0 & (x~=%inf) & or(b(:)~=%inf))
+ // Make it scream for scalar x. Polynomial evaluation can be
+ // implemented as a recursive digital filter.
+ q=b;
+ k = filter(1,[1 -real(x)],q);
+ k=k(nc);
+ end
+ k=abs(k);
+ renorm = 1/k
+
+
+ // normalize the filter
+ b = renorm*b;
end
- select(rhs)
- case 2 then
- B = callOctave("fir1", N, W);
- case 3 then
- B = callOctave("fir1", N, W, varargin(1));
- case 4 then
- B = callOctave("fir1", N, W, varargin(1), varargin(2));
- case 5 then
- B = callOctave("fir1", N, W, varargin(1), varargin(2), varargin(3));
- end
endfunction
diff --git a/macros/fir2.sci b/macros/fir2.sci
index 990fb3e..5caba69 100644
--- a/macros/fir2.sci
+++ b/macros/fir2.sci
@@ -1,41 +1,122 @@
-function B = fir2(N, F, M, varargin)
-//Produce an order N FIR filter with arbitrary frequency response M over frequency bands F, returning the N+1 filter coefficients in B.
-//Calling Sequence
-//B = fir2(N, F, M)
-//B = fir2(N, F, M, GRID_N)
-//B = fir1(N, F, M, GRID_N, RAMP_N)
-//B = fir1(N, F, M, GRID_N, RAMP_N, WINDOW)
-//Parameters
-//N: Integer
-//F, M: Vector
-//Description
-//Produce an order N FIR filter with arbitrary frequency response M over frequency bands F, returning the N+1 filter coefficients in B. The vector F specifies the frequency band edges of the filter response and M specifies the magnitude response at each frequency.
-//
-//The vector F must be nondecreasing over the range [0,1], and the first and last elements must be 0 and 1, respectively. A discontinuous jump in the frequency response can be specified by duplicating a band edge in F with different values in M.
-//
-//The resolution over which the frequency response is evaluated can be controlled with the GRID_N argument. The default is 512 or the next larger power of 2 greater than the filter length.
-//
-//The band transition width for discontinuities can be controlled with the RAMP_N argument. The default is GRID_N/25. Larger values will result in wider band transitions but better stopband rejection.
+function b = fir2(n, f, m, grid_n, ramp_n, window_in)
+
+ funcprot(0);
+ rhs= argn(2);
+
+ if rhs < 3 | rhs > 6
+ error("Wrong Number of input arguments");
+ end
+
+//verify frequency and magnitude vectors are reasonable
+
+ t = length(f);
+ if t<2 | f(1)~=0 | f(t)~=1 | or(diff(f)<0)
+ error ("fir2: frequency must be nondecreasing starting from 0 and ending at 1");
+ elseif t ~= length(m)
+ error ("fir2: frequency and magnitude vectors must be the same length");
+//find the grid spacing and ramp width
+ elseif (rhs>4 & length(grid_n)>1) | (rhs>5 & (length(grid_n)>1 | length(ramp_n)>1))
+ error ("fir2: grid_n and ramp_n must be integers");
+ end
+ if rhs < 4, grid_n=[]; end
+ if rhs < 5, ramp_n=[]; end
+
+//find the window parameter, or default to hamming
//
-//An optional shaping WINDOW can be given as a vector with length N+1. If not specified, a Hamming window of length N+1 is used.
-//Examples
-// fir2 (10, [0, 0.5, 1], [1, 2, 3])
-//ans =
-// -0.00130 0.00000 -0.01792 0.00000 -0.36968 2.00000 -0.36968 0.00000 -0.01792 0.00000 -0.00130
-funcprot(0);
-rhs = argn(2);
-if(rhs<3 | rhs>6)
-error("Wrong number of input arguments.");
-end
-
- select(rhs)
- case 3 then
- B = callOctave("fir2", N, F, M);
- case 4 then
- B = callOctave("fir2", N, F, M, varargin(1));
- case 5 then
- B = callOctave("fir2", N, F, M, varargin(1), varargin(2));
- case 6 then
- B = callOctave("fir2", N, F, M, varargin(1), varargin(2), varargin(3));
- end
+ w=[];
+ if length(grid_n)>1 then
+ w=grid_n; grid_n=[];
+ end
+ if length(ramp_n)>1 then
+ w=ramp_n; ramp_n=[];
+ end
+ if rhs < 6 then
+ window_in=w;
+ end
+
+ if isempty(window_in) then
+ window_out=hamming(n+1);
+ elseif(isvector(window_in) & length(window_in) == n+1)
+ window_out=window_in;
+ elseif type((window_in)==10)
+
+ if(window_in=="bartlett" | window_in=="blackman" | window_in=="blackmanharris" |...
+ window_in=="bohmanwin" | window_in=="boxcar" | window_in=="barthannwin" |...
+ window_in=="chebwin"| window_in=="flattopwin" | window_in=="gausswin" |...
+ window_in=="hamming" | window_in=="hanning" | window_in=="hann" |...
+ window_in=="kaiser" | window_in=="parzenwin" | window_in=="triang" |...
+ window_in=="rectwin" | window_in=="tukeywin" | window_in=="blackmannuttall" |...
+ window_in=="nuttallwin")
+
+ c =evstr (window_in);
+ window_out=c(n+1);
+ else
+ error("Use proper Window name")
+ end
+ end
+ if(length(window_out) ~= n+1)
+ error ("fir2: window_in must be of length n+1");
+ end
+
+//Default grid size is 512... unless n+1 >= 1024
+ if isempty (grid_n)
+ if n+1 < 1024
+ grid_n = 512;
+ else
+ grid_n = n+1;
+ end
+ end
+
+//ML behavior appears to always round the grid size up to a power of 2
+ grid_n = 2 ^ nextpow2 (grid_n);
+
+//Error out if the grid size is not big enough for the window
+ if 2*grid_n < n+1
+ error ("fir2: grid size must be greater than half the filter order");
+ end
+
+ if isempty (ramp_n), ramp_n = fix (grid_n / 25); end
+
+//Apply ramps to discontinuities
+ if (ramp_n > 0)
+//remember original frequency points prior to applying ramps
+ basef = f(:); basem = m(:);
+
+//separate identical frequencies, but keep the midpoint
+ idx = find (diff(f) == 0);
+ f(idx) = f(idx) - ramp_n/grid_n/2;
+ f(idx+1) = f(idx+1) + ramp_n/grid_n/2;
+ basef_idx=basef(idx);
+ f = [f(:);basef_idx]';
+
+//make sure the grid points stay monotonic in [0,1]
+ f(f<0) = 0;
+ f(f>1) = 1;
+ f = unique([f(:);basef_idx(:)]');
+
+//preserve window shape even though f may have changed
+ m = interp1(basef, basem, f,'nearest');
+ end
+
+//interpolate between grid points
+ grid = interp1(f,m,linspace(0,1,grid_n+1)','nearest');
+
+//Transform frequency response into time response and
+//center the response about n/2, truncating the excess
+ if (modulo(n,2) == 0)
+ b = ifft([grid ; grid(grid_n:-1:2)]);
+ mid = (n+1)/2;
+ b = real ([ b([$-floor(mid)+1:$]) ; b(1:ceil(mid)) ]);
+ else
+ //Add zeros to interpolate by 2, then pick the odd values below.
+ b = ifft([grid ; zeros(grid_n*2,1) ;grid(grid_n:-1:2)]);
+ b = 2 * real([ b([$-n+1:2:$]) ; b(2:2:(n+1))]);
+ end
+
+
+//Multiplication in the time domain is convolution in frequency,
+//so multiply by our window now to smooth the frequency response.
+//Also, for matlab compatibility, we return return values in 1 row
+ b = b(:)' .* window_out(:)';
+
endfunction
diff --git a/macros/firtype.sci b/macros/firtype.sci
index 4fa1122..4a17e4e 100644
--- a/macros/firtype.sci
+++ b/macros/firtype.sci
@@ -1,6 +1,27 @@
//Author: Parthasarathi Panda
//parthasarathipanda314@gmail.com
function typ=firtype(b)
+//This function identifies Type of linear phase FIR filter
+
+//Calling Sequence
+//t = firtype(b)
+
+//Parameters
+//t: type of an FIR filter
+//b: Filter coefficients
+
+//Description
+//t = firtype(b) determines the type, t, of an FIR filter with coefficients b. t can be 1, 2, 3, or 4. The filter must be real and have linear phase.
+
+//Examples
+//b=[9.2762e-05 9.5482e-02 4.0443e-01 4.0443e-01 9.5482e-02 9.2762e-05]
+//firtype(b)
+//Output : 2
+
+//b=[-1 -2 0 2 1]
+//firtype(b)
+//Output : 3
+
if (type(b)~=1) then
error('check input type');
end
diff --git a/macros/flattopwin.sci b/macros/flattopwin.sci
index 41250c1..905a1be 100644
--- a/macros/flattopwin.sci
+++ b/macros/flattopwin.sci
@@ -1,47 +1,56 @@
function w = flattopwin (m, opt)
+
//This function returns the filter coefficients of a Flat Top window.
//Calling Sequence
//w = flattopwin (m)
//w = flattopwin (m, opt)
-//Parameters
+//Parameters
//m: positive integer value
//opt: string value, takes in "periodic" or "symmetric"
-//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 Flat Top window of length m supplied as input, to the output vector w.
//The second parameter can take the values "periodic" or "symmetric", depending on which the corresponding form of window is returned. The default is symmetric.
-//This window has low pass-band ripple but a high bandwidth.
+//This window has low pass-band ripple but a high bandwidth.
//Examples
//flattopwin(8,"periodic")
//ans =
-// 0.0009051
-// - 0.0264124
-// - 0.0555580
-// 0.4435496
-// 1.
-// 0.4435496
-// - 0.0555580
-// - 0.0264124
-funcprot(0);
-rhs = argn(2)
-if(rhs<1 | rhs>2)
-error("Wrong number of input arguments.")
-end
+// 0.0009051
+// - 0.0264124
+// - 0.0555580
+// 0.4435496
+// 1.
+// 0.4435496
+// - 0.0555580
+// - 0.0264124
-if(rhs==2)
- if(opt~="periodic" & opt~="symmetric")
- error("Window type should be periodic or symmetric.")
- end
-end
+ funcprot(0);
+ rhs= argn(2);
- select(rhs)
- case 1 then
- w = callOctave("flattopwin",m)
- case 2 then
- w = callOctave("flattopwin",m,opt)
- end
-endfunction
+ if (rhs < 1 | rhs > 2)
+ error("Wrong Number of input arguments");
+ elseif (~ (isscalar (m) & (m == fix (m)) & (m > 0)))
+ error ("flattopwin: M must be a positive integer");
+ end
+ N = m - 1;
+ if (rhs == 2)
+ select (opt)
+ case "periodic"
+ N = m;
+ case "symmetric"
+ N = m - 1;
+ else
+ error ("flattopwin: window type must be either periodic or symmetric");
+ end
+ end
+ if (m == 1)
+ w = 1;
+ else
+ x = 2*%pi*[0:m-1]'/N;
+ w = (1-1.93*cos(x)+1.29*cos(2*x)-0.388*cos(3*x)+0.0322*cos(4*x))/4.6402;
+ end
+endfunction
diff --git a/macros/fwhmjlt.sci b/macros/fwhmjlt.sci
index 4e9eb9c..129bffc 100644
--- a/macros/fwhmjlt.sci
+++ b/macros/fwhmjlt.sci
@@ -1,4 +1,26 @@
-function [f]=bitrevorder(y,varargin)
+function [f]=fwhmjlt(y,varargin)
+//This function Computes peak full-width at half maximum
+
+//calling sequence
+//f = fwhm (y)
+//f = fwhm (x, y)
+//f = fwhm (…, "zero")
+//f = fwhm (…, "min")
+//f = fwhm (…, "alevel", level)
+//f = fwhm (…, "rlevel", level)
+
+//Description
+//Compute peak full-width at half maximum (FWHM) or at another level of peak maximum for vector or matrix data y, optionally sampled as y(x). If y is a matrix, return FWHM for each column as a row vector.
+//The default option "zero" computes fwhm at half maximum, i.e. 0.5*max(y). The option "min" computes fwhm at the middle curve, i.e. 0.5*(min(y)+max(y)).
+//The option "rlevel" computes full-width at the given relative level of peak profile
+//The option "alevel" computes full-width at the given absolute level of y.
+
+//Example
+//t=-50:0.01:50;
+//y=(1/(2*sqrt(2*%pi)))*exp(-(t.^2)/8);
+//z=fwhmjlt(y)
+//Output: 470.96442
+
rhs = argn(2)
if(rhs<1 | rhs>5)
error("Wrong number of input arguments.")
diff --git a/macros/hamming.sci b/macros/hamming.sci
index 49a970f..79d97fa 100644
--- a/macros/hamming.sci
+++ b/macros/hamming.sci
@@ -1,24 +1,33 @@
-function y = hamming(m, varargin)
-//Return the filter coefficients of a Hamming window of length M
-//Calling Sequence
-//hamming (M)
-//hamming (M, "periodic")
-//hamming (M, "symmetric")
-//Parameters
-//M: real scalar, which will be the length of hamming window
-//Description
-//Return the filter coefficients of a Hamming window of length M.
-//If the optional argument "periodic" is given, the periodic form of the window is returned. This is equivalent to the window of length M+1 with the last coefficient removed. The optional argument "symmetric" is equivalent to not specifying a second argument.
-funcprot(0);
-rhs= argn(2);
-if(rhs <1 | rhs>2)
-error("Wrong number of Input parameters");
-end
+function c = hamming (m, opt)
+
+ funcprot(0);
+ rhs= argn(2);
+
+ if (rhs < 1 | rhs > 2)
+ error("Wrong Number of input arguments");
+ end
+
+ if (~ (isscalar (m) & (m == fix (m)) & (m > 0)))
+ error ("hamming: M must be a positive integer");
+ end
+
+ N = m - 1;
+ if (rhs == 2)
+ select (opt)
+ case "periodic"
+ N = m;
+ case "symmetric"
+ //Default option, same as no option specified.
+ else
+ error ('hamming: window type must be either periodic or symmetric");
+ end
+ end
+
+ if (m == 1)
+ c = 1;
+ else
+ m = m - 1;
+ c = 0.54 - 0.46 * cos (2 * %pi * (0 : m)' / N);
+ end
-select(rhs)
- case 1 then
- y= callOctave("hamming", m);
- case 2 then
- y= callOctave("hamming", m , varargin(1));
-end
endfunction
diff --git a/macros/hann.sci b/macros/hann.sci
index b95ed4f..6a195c2 100644
--- a/macros/hann.sci
+++ b/macros/hann.sci
@@ -28,10 +28,6 @@ if(rhs<1 | rhs>2)
error("Wrong number of input arguments.")
end
- select(rhs)
- case 1 then
- w = callOctave("hann",varargin(1))
- case 2 then
- w = callOctave("hann",varargin(1),varargin(2))
- end
+w = hanning (varargin(:));
+
endfunction
diff --git a/macros/hanning.sci b/macros/hanning.sci
index 60ca783..e206eaf 100644
--- a/macros/hanning.sci
+++ b/macros/hanning.sci
@@ -1,25 +1,33 @@
-function y = hanning(m, varargin)
-//Return the filter coefficients of a Hanning window of length M
-//Calling Sequence
-//hanning (M)
-//hanning (M, "periodic")
-//hanning (M, "symmetric")
-//Parameters
-//M: real scalar, which will be the length of hanning window
-//Description
-//Return the filter coefficients of a Hanning window of length M.
-//If the optional argument "periodic" is given, the periodic form of the window is returned. This is equivalent to the window of length M+1 with the last coefficient removed. The optional argument "symmetric" is equivalent to not specifying a second argument.
+function c = hanning (m, opt)
-funcprot(0);
-rhs= argn(2);
-if(rhs <1 | rhs>2)
-error("Wrong number of Input parameters");
-end
+ funcprot(0);
+ rhs= argn(2);
+
+ if (rhs < 1 | rhs > 2)
+ error("Wrong Number of input arguments");
+ end
+
+ if (~ (isscalar (m) & (m == fix (m)) & (m > 0)))
+ error ("hanning: M must be a positive integer");
+ end
+
+ N = m - 1;
+ if (rhs == 2)
+ select (opt)
+ case "periodic"
+ N = m;
+ case "symmetric"
+ //Default option, same as no option specified.
+ else
+ error ('hanning: window type must be either periodic or symmetric");
+ end
+ end
+
+ if (m == 1)
+ c = 1;
+ else
+ m = m - 1;
+ c = 0.5 - 0.5 * cos (2 * %pi * (0 : m)' / N);
+ end
-select(rhs)
- case 1 then
- y= callOctave("hanning", m);
- case 2 then
- y= callOctave("hanning", m , varargin(1));
-end
endfunction
diff --git a/macros/helperHarmonicDistortionAmplifier.sci b/macros/helperHarmonicDistortion.sci
index 511b3a9..3537869 100755..100644
--- a/macros/helperHarmonicDistortionAmplifier.sci
+++ b/macros/helperHarmonicDistortion.sci
@@ -1,6 +1,25 @@
-function outputVoltage = helperHarmonicDistortionAmplifier(inputVoltage)
+function outputVoltage = helperHarmonicDistortion(inputVoltage)
//helperHarmonicDistortionADC Helper function for HarmonicDistortionExample.m
+//Calling Sequence
+// outputVoltage=helperHarmonicDistortionAmplifier(inputVoltage)
+
+//Description
+//Analizing the harmonic distortion of a weakly non-linear system in the presence of noise.
+
+//Example
+//VmaxPk = 2;
+//Fi = 2000;
+//Fs = 44.1e3;
+//Tstop = 50e-3;
+//t = 0:1/Fs:Tstop;
+//inputVmax = VmaxPk*sin(2*%pi*Fi*t);z
+//outputVmax = helperHarmonicDistortionAmplifier(inputVmax);
+//plot(t, outputVmax);replot([0,-2.5,0.005,2.5]);
+//xlabel('Time')
+//ylabel('Output Voltage')
+//title('Amplifier output')
+
// model parameters
noiseVrms = 0.4e-6; // RMS voltage of input noisefloor
@@ -25,7 +44,3 @@ distortedInput = inputVoltage + inputNoise;
// adjust input by DC bias, voltage gain and higher order terms
outputVoltage = polyval(polyCoeff, distortedInput);
endfunction
-
-
-
-
diff --git a/macros/icceps.sci b/macros/icceps.sci
index 07debde..29683fd 100644
--- a/macros/icceps.sci
+++ b/macros/icceps.sci
@@ -7,6 +7,13 @@ function inv_ceps = icceps(input, remv_samp)
// Outputs:
// inv_ceps: Inverse cepstrum output
+//Example
+//xhat=[ 2.2428 -0.0420 -0.0210 0.0045 0.0366 0.0788 0.1386 0.2327 0.4114 0.9249]
+//icc = icceps(xhat,2);
+//round(icc)
+//OUTPUT:
+// 2 3 4 5 6 7 8 9 10 1
+
// Check validity of number of inout arguments
checkNArgin(1,3, argn(2));
diff --git a/macros/impinvar.sci b/macros/impinvar.sci
index ff90f6a..cc9aa6f 100644
--- a/macros/impinvar.sci
+++ b/macros/impinvar.sci
@@ -31,10 +31,13 @@ end
select(rhs)
case 2 then
- [b, a] = callOctave("impinvar",b,a)
+// [b, a] = callOctave("impinvar",b,a)
+ [b_out, a_out] = callOctave("impinvar",b,a)
case 3 then
- [b, a] = callOctave("impinvar",b,a,fs)
+// [b, a] = callOctave("impinvar",b,a,fs)
+ [b_out, a_out] = callOctave("impinvar",b,a,fs)
case 4 then
- [b, a] = callOctave("impinvar",b,a,fs,tol)
+// [b, a] = callOctave("impinvar",b,a,fs,tol)
+ [b_out, a_out] = callOctave("impinvar",b,a,fs,tol)
end
endfunction
diff --git a/macros/impz.sci b/macros/impz.sci
index cfa9b32..1172b81 100644
--- a/macros/impz.sci
+++ b/macros/impz.sci
@@ -1,6 +1,6 @@
function [x_r, t_r] = impz(b, a, n, fs)
+// It gives Impulse response of digital filter
-//
//Calling Sequence
//x_r = impz(b)
//x_r = impz(b, a)
@@ -8,13 +8,27 @@ function [x_r, t_r] = impz(b, a, n, fs)
//x_r = impz(b, a, n, fs)
//[x_r, t_r] = impz(b, a, n, fs)
-//Parameters
-//
+//Parameters
+//x_r: impz chooses the number of samples and returns the response in the column vector, x_r.
+//t_r : impz returns the sample times in the column vector, t_r
+// b : numerator coefficients of the filter
+// a : denominator coefficients of the filter
+// n : samples of the impulse response t(by default ,n = length(t) and is computed automatically.
+// fs : sampling frequency
//Description
+//[x_r,t_r] = impz(b,a) returns the impulse response of the filter with numerator coefficients, b, and denominator coefficients, a. impz chooses the number of samples and returns the response in the column vector, x_r, and the sample times in the column vector, t_r. t_r = [0:n-1]' and n = length(t) is computed automatically.
//Examples
+//[x_r,t_r]=impz([0 1 1],[1 -3 3 -1],10)
+//OUTPUT :
+// t_r = 0. 1. 2. 3. 4. 5. 6. 7. 8. 9
+// x_r= 0. 1. 4. 9. 16. 25. 36. 49.....64......81
+//[x_r,t_r]=impz(1,[1 1],5)
+//OUTPUT
+// t_r = 0. 1. 2. 3. 4
+//x_r = 1. - 1. 1. - 1. 1.
//This function is being called from Octave
diff --git a/macros/impzlength.sci b/macros/impzlength.sci
index 6e75968..da7900a 100644
--- a/macros/impzlength.sci
+++ b/macros/impzlength.sci
@@ -6,7 +6,7 @@ function len = impzlength (b, varargin)
// len = impzlength(b, a, tol)
// returns the impulse response length for the causal discrete-time filter
// with the transfer function coefficients for numerator and denominator in
-// a and b respectively. For stable IIR filters, len is the effective length
+// b and a respectively. For stable IIR filters, len is the effective length
// impulse response length, i.e. the length after which the response is
// essentially zero
// len = impzlength(sos)
@@ -34,8 +34,17 @@ function len = impzlength (b, varargin)
// 1) Low pass IIR filter with pole at 0.9
// b = 1;
// a = [1 -0.9];
-// len = impzlength(b,a);
+// len = impzlength(b,a)
+//OUTPUT :
+// len=93
//
+//2) High pass IIR filter with pole at -0.5
+// b = 1;
+// a = [1 0.5];
+// len = impzlength(b,a)
+//OUTPUT :
+// len=14
+
// See also
// designfilt | digitalFilter | impz | zp2sos
//
diff --git a/macros/interp.sci b/macros/interp.sci
deleted file mode 100644
index dd7e9e0..0000000
--- a/macros/interp.sci
+++ /dev/null
@@ -1,38 +0,0 @@
-//function already exists in scilab -- doesnt work like this one (I guess)
-function y = interp(x, q, n, Wc)
-//This function upsamples the signal x by a factor of q, using an order 2*q*n+1 FIR filter.
-//Calling Sequence
-//y = interp(x, q)
-//y = interp(x, q, n)
-//y = interp(x, q, n, Wc)
-//Parameters
-//x: scalar or vector of complex or real numbers
-//q: positive integer value, or logical
-//n: positive integer, default value 4
-//Wc: non decreasing vector or scalar, starting from 0 uptill 1, default value 0.5
-//Description
-//This is an Octave function.
-//This function upsamples the signal x by a factor of q, using an order 2*q*n+1 FIR filter.
-//The second argument q must be an integer. The default values of the third and fourth arguments (n, Wc) are 4 and 0.5 respectively.
-//Examples
-//interp(1,2)
-//ans =
-// 0.4792743 0.3626016
-funcprot(0);
-rhs = argn(2)
-if(rhs<2 | rhs>4) //source code says rhs<1 -- but crashes for just one arg
-error("Wrong number of input arguments.")
-end
-
-
-
-
- select(rhs)
- case 2 then
- y = callOctave("interp",x,q)
- case 3 then
- y = callOctave("interp",x,q,n)
- case 4 then
- y = callOctave("interp",x,q,n,Wc)
- end
-endfunction
diff --git a/macros/intfilt.sci b/macros/intfilt.sci
index 15da95c..44fffbf 100644
--- a/macros/intfilt.sci
+++ b/macros/intfilt.sci
@@ -1,36 +1,54 @@
function [h, a]= intfilt(R, L, freqmult)
-
-
+
+
// This function estimate Interpolated FIR Filter Design.
// Calling Sequence
// h=intfilt(R,L,freqmult)
// [h a]=intfilt(R,L,freqmult)
-
+
// Parameters
// R: Samples. It should be numeric
// L: bandlimited interpolation samples. It must be nonzero.
- // freqmult: bandlimitedness of ALPHA times the Nyquist frequency, IT can be numeric or character ('B' or 'L', B is length
+ // freqmult: bandlimitedness of ALPHA times the Nyquist frequency, IT can be numeric or character ('B' or 'L', B is length
// (N+1)*L-1 for N odd and (N+1)*L for N even)
-
- // h: linear phase FIR filter.
-
+
+ // h: linear phase FIR filter.
+
// Examples
- // h=intfilt(20,10,'l')
- // h=intfilt(20,10,1)
- //
+ // h=intfilt(20,10,'l') // The output of this example has 220 columns ,so it is difficult to write it here.
+ // h=intfilt(20,10,1) // The output of this example has 220 columns ,so it is difficult to write it here.
+
+ //h1=intfilt(2,3,'l');
+ //OUTPUT :
+ // - 0.0625 0. 0.5625 1. 0.5625 0. - 0.0625
+
+ //h2=intfilt(4,1,1);
+ //OUTPUT :
+ // 0.3001054 0.6366198 0.9003163 1. 0.9003163 0.6366198 0.3001054
+
// See also
// Authors
// Jitendra Singh
-
+funcprot(0);
+[lhs,rhs]=argn(0);
+
+if (rhs~=3) then
+ error ("Wrong number of input arguments.")
+end
+
+if (lhs<1 | lhs>2) then
+ error ("Wrong number of input arguments.")
+end
+
if or(type(R)==10) | or(type(L)==10) then
error ('Argument R and L must be numeric.')
-
+
else
-
-
-
-
+
+
+
+
if argn(2)==3 then
if type(freqmult)==10 then
typ=freqmult;
@@ -39,51 +57,51 @@ function [h, a]= intfilt(R, L, freqmult)
freqmult=double(freqmult);
typ='b';
end
-
+
end
-
+
if freqmult==0 then
h=repmat(%nan,[1,(2*R*L-1)])
a=1;
else
-
-
+
+
//typ(1)=='b' | typ(1)=='B'
-
+
if convstr(typ(1), 'u') =='B' then
n=2*R*L-1;
-
-
+
+
if freqmult==1 then
M=[R R 0 0];
F= [0 1/(2*R) 1/(2*R) 0.5];
else
M=R*[1 1];
-
- if type(freqmult)==10 then
+
+ if type(freqmult)==10 then
F=[0 98/2/R];
else
F=[0 freqmult/2/R]
end
-
+
for f=(1/R):(1/R):.5,
-
+
if type(freqmult)==10 then
- F=[F f-(98/2/R) f+(98/2/R)];
+ F=[F f-(98/2/R) f+(98/2/R)];
else
- F=[F f-(freqmult/2/R) f+(freqmult/2/R)];
+ F=[F f-(freqmult/2/R) f+(freqmult/2/R)];
end
-
+
M=[M 0 0];
end;
if (F(length(F))>.5),
F(length(F))=.5;
end;
- end
+ end
N=n-1; F=F*2; M=M
-
-
+
+
if (max(F)>1) | (min(F)<0)
error('Frequencies in F must be in range [0,1]')
end
@@ -107,9 +125,9 @@ end
ftype = 0; differ = 0;
-N = N+1;
-
-F=F(:)/2; M=M(:); W=sqrt(W(:));
+N = N+1;
+
+F=F(:)/2; M=M(:); W=sqrt(W(:));
dF = diff(F);
if (length(F) ~= length(W)*2)
@@ -118,9 +136,9 @@ end
if or(dF<0),
-
+
error('F frequency must be increasing')
-
+
end
@@ -142,67 +160,67 @@ Nodd = N-fix(N./2).*2;
if ~Nodd
- m=(0:L)+.5;
+ m=(0:L)+.5;
else
- m=(0:L);
+ m=(0:L);
end
-
-
+
+
k=m';
need_matrix = (~band) | (~weights);
-
-
-
-
+
+
+
+
if need_matrix
-
- I1=k(:,ones(size(m,1),size(m,2)))+m(ones(size(k,1),size(k,2)),:);
- I2=k(:,ones(size(m,1),size(m,2)))-m(ones(size(k,1),size(k,2)),:);
+
+ I1=k(:,ones(size(m,1),size(m,2)))+m(ones(size(k,1),size(k,2)),:);
+ I2=k(:,ones(size(m,1),size(m,2)))-m(ones(size(k,1),size(k,2)),:);
G=zeros(size(I1,1),size(I1,2));
end
if Nodd
k=k(2:length(k));
- b0=0;
+ b0=0;
end;
b=zeros(size(k,1),size(k,2));
-
+
dd=diff(F);
-
+
if or(dd==0) & R==1 then
-
+
h=repmat(%nan,[1,n])
a=1
-
+
else
for s=1:2:length(F),
-
- m=(M(s+1)-M(s))/(F(s+1)-F(s));
- b1=M(s)-m*F(s);
+
+ m=(M(s+1)-M(s))/(F(s+1)-F(s));
+ b1=M(s)-m*F(s);
if Nodd
b0 = b0 + (b1*(F(s+1)-F(s)) + m/2*(F(s+1)*F(s+1)-F(s)*F(s)))* abs(W((s+1)/2)^2) ;
end
-
+
b=b(:)
b = b+(m/(4*%pi*%pi)*(cos(2*%pi*k*F(s+1))-cos(2*%pi*k*F(s)))./(k.*k))* abs(W((s+1)/2)^2);
-
-
-
+
+
+
b = b' + (F(s+1)*(m*F(s+1)+b1)*sinf(2*k*F(s+1))- F(s)*(m*F(s)+b1)*sinf(2*k*F(s)))* abs(W((s+1)/2)^2);
if need_matrix
-
-
+
+
mat=matrix((.5*F(s+1)*(sinf(2*I1*F(s+1))+sinf(2*I2*F(s+1)))- .5*F(s)*(sinf(2*I1*F(s))+sinf(2*I2*F(s))) ) * abs(W((s+1)/2)^2),size(G,1),size(G,2)) ;
mat=mat';
- G=G+mat;
-
+ G=G+mat;
+
end
end;
-
+
if Nodd
b=[b0; b'];
end;
@@ -219,23 +237,23 @@ Nodd = N-fix(N./2).*2;
h=[a(L+1:-1:2)/2; a(1); a(2:L+1)/2].';
else
h=.5*[flipud(a); a].';
- end;
- end;
-
- //typ(1)=='l' | typ(1)=='L'
-
+ end;
+ end;
+
+ //typ(1)=='l' | typ(1)=='L'
+
+
-
elseif convstr(typ(1), 'u') =='L' then
-
+
if n==0 then
h=ones(1,R)
- return
- end
-
+ return
+ end
+
t=0:n*R+1;
l=ones(n+1,length(t));
-
+
for i=1:n+1
for j=1:n+1
if (j~=i) then
@@ -243,9 +261,9 @@ Nodd = N-fix(N./2).*2;
end
end
end
-
+
h=zeros(1,(n+1)*R);
-
+
for i=0:R-1
for j=0:n
h(j*R+i+1)=l((n-j)+1,round((n-1)/2*R+i+1));
@@ -260,15 +278,15 @@ if h(1) == 0,
else
error ('This type of filter is not recognized.')
-
-
+
+
end
a=1;
-
-
+
+
end
end
-
+
endfunction
@@ -276,16 +294,16 @@ endfunction
////// Supplementary function
function y=sinf(x)
-
+
for i=1:length(x)
if x(i)==0 then
y(i)=1;
else
-
+
y(i)=sin(%pi*x(i))/(%pi*x(i));
end
-
- end
-
+
+ end
+
y=y';
endfunction
diff --git a/macros/is2rc.sci b/macros/is2rc.sci
index ad68f5f..864365b 100644
--- a/macros/is2rc.sci
+++ b/macros/is2rc.sci
@@ -1,38 +1,48 @@
-function [k] = is2rc(isin)
-// Convert inverse sine parameters to reflection coefficients
-//
-// Calling Sequence
-// K = is2rc(isin)
-//
-// Parameters
-// isin: input inverse sine parameters. Needs to be an array real numbers
-// k: output reflection coefficients corresponding to the reflection coefficients in input
-//
-// Description
-// This function returns a vector of reflection coefficients from a vector of inverse sine parameters
-// output array has k(i) = sin(pi/2*isin(i))
-//
-// Example
-// k = [0.3090 0.9801 0.0031 0.0082 -0.0082];
-// isin = rc2is(k) //Gives inverse sine parameters
-// k_dash = is2rc(isin)
-//
-// See also
-// rc2is
-// rc2poly
-// rc2ac
-// rc2lar
-//
-// Author
-// Parthe Pandit
-//
-// Bibliography
-// J.R. Deller, J.G. Proakis, J.H.L. Hansen, "Discrete-Time Processing of Speech Signals", Prentice Hall, Section 7.4.5
-
-//errcheck1
-if (~isreal(isin)),
- error('Input inverse sine coefficients are not real');
-end
-
-k = sin(isin*%pi/2);
-endfunction
+function [k] = is2rc(isin)
+// Convert inverse sine parameters to reflection coefficients
+//
+// Calling Sequence
+// K = is2rc(isin)
+//
+// Parameters
+// isin: input inverse sine parameters. Needs to be an array real numbers
+// k: output reflection coefficients corresponding to the reflection coefficients in input
+//
+// Description
+// This function returns a vector of reflection coefficients from a vector of inverse sine parameters
+// output array has k(i) = sin(pi/2*isin(i))
+//
+// Example
+// k = [0.3090 0.9801 0.0031 0.0082 -0.0082];
+// isin = rc2is(k) //Gives inverse sine parameters
+// k_dash = is2rc(isin)
+//
+// OUTPUT :
+// isin = [0.1999886 0.8727832 0.0019735 0.0052203.....- 0.0052203 ]
+// k_dash =[0.309 0.9801 0.0031 0.0082 - 0.0082]
+
+//isin = [0.2000 0.8727 0.0020 0.0052 -0.0052];
+//k = is2rc(isin)
+//
+//OUTPUT :
+// k = [0.3090170 0.9800741 0.0031416 0.0081681..... - 0.0081681 ]
+
+// See also
+// rc2is
+// rc2poly
+// rc2ac
+// rc2lar
+//
+// Author
+// Parthe Pandit
+//
+// Bibliography
+// J.R. Deller, J.G. Proakis, J.H.L. Hansen, "Discrete-Time Processing of Speech Signals", Prentice Hall, Section 7.4.5
+
+//errcheck1
+if (~isreal(isin)),
+ error('Input inverse sine coefficients are not real');
+end
+
+k = sin(isin*%pi/2);
+endfunction
diff --git a/macros/isallpass.sci b/macros/isallpass.sci
index d76c295..ba14c4e 100644
--- a/macros/isallpass.sci
+++ b/macros/isallpass.sci
@@ -5,10 +5,32 @@
//flag = isallpass(sos)
//flag = isallpass(...,tol)
// b and a are the vectors containing zero and pole coefficients respectively
-//tol, tolerance is used to determine when two numbers are close enough to be considered equal.
+//tol, tolerance is used to determine when two numbers are close enough to be considered equal.
//Author: Parthasarathi Panda
//parthasarathipanda314@gmail.com
function isall=isallpass(varargin)
+
+//Example
+//k = [1/2 1/3 1/4 1/5];
+//[b,a] = latc2tf(k,'allpass');
+//flag_isallpass = isallpass(b,a)
+//
+//OUTPUT :
+// flag_isallpass =1
+
+
+//b = [1/3 1/4 1/5 1];
+//a=b($:-1:1);
+//flag = isallpass(b,a)
+//
+//OUTPUT
+// flag=1
+
+
+//fl=isallpass(1,[1 1])
+//
+//OUTPUT
+// fl=0
[nargout,nargin]=argn();
if (nargin==2) then
v=size(varargin(1));
diff --git a/macros/nuttallwin.sci b/macros/nuttallwin.sci
index c066ef5..a7090ad 100644
--- a/macros/nuttallwin.sci
+++ b/macros/nuttallwin.sci
@@ -1,34 +1,39 @@
function w = nuttallwin (m, opt)
-//This function returns the filter coefficients of a Blackman-Harris window.
-//Calling Sequence
-//w = nuttallwin (m)
-//w = nuttallwin (m, opt)
-//Parameters
-//m: positive integer value
-//opt: string value, takes in "periodic" or "symmetric"
-//w: output variable, vector of real numbers
-//Description
-//This is an Octave function.
-//This function returns the filter coefficients of a Blackman-Harris window defined by Nuttall of length m supplied as input, to the output vector w.
-//The second parameter can take the values "periodic" or "symmetric", depending on which the corresponding form of window is returned. The default is symmetric.
-//Examples
-//nuttallwin(2, "periodic")
-//ans =
-// - 2.429D-17
-// 1.
+ funcprot(0);
+ rhs= argn(2);
+ if (rhs < 1 | rhs > 2)
+ error("Wrong Number of input arguments");
+ end
-rhs = argn(2)
-if(rhs<1 | rhs>2)
-error("Wrong number of input arguments.")
-end
+ if (~ (isscalar (m) & (m == fix (m)) & (m > 0)))
+ error ("nuttallwin: M must be a positive integer");
+ end
- select(rhs)
- case 1 then
- w = callOctave("nuttallwin",m)
- case 2 then
- w = callOctave("nuttallwin",m,opt)
- end
-endfunction
+ N = m - 1;
+ if (rhs == 2)
+ select (opt)
+ case "periodic"
+ N = m;
+ case "symmetric"
+ N = m-1;
+ else
+ error ('nuttallwin: window type must be either periodic or symmetric");
+ end
+ end
+
+ if (m == 1)
+ w = 1;
+ else
+ a0 = 0.355768;
+ a1 = 0.487396;
+ a2 = 0.144232;
+ a3 = 0.012604;
+// n = [-N/2:(m-1)/2]';
+// w = a0 + a1.*cos(2.*%pi.*n./N) + a2.*cos(4.*%pi.*n./N) + a3.*cos(6.*%pi.*n./N);
+ n=[0:m-1]'
+ w = a0 - a1.*cos(2.*%pi.*n./N) + a2.*cos(4.*%pi.*n./N) - a3.*cos(6.*%pi.*n./N);
+ end
+endfunction
diff --git a/macros/oct_interp.sci b/macros/oct_interp.sci
new file mode 100644
index 0000000..d4fc6e6
--- /dev/null
+++ b/macros/oct_interp.sci
@@ -0,0 +1,105 @@
+//.............................................................................................................
+// ................................Using "callOctave" method..............................
+//.............................................................................................................
+
+
+
+//function already exists in scilab -- doesnt work like this one (I guess)
+//function y = interp(x, q, n, Wc)
+//This function upsamples the signal x by a factor of q, using an order 2*q*n+1 FIR filter.
+//Calling Sequence
+//y = interp(x, q)
+//y = interp(x, q, n)
+//y = interp(x, q, n, Wc)
+//Parameters
+//x: scalar or vector of complex or real numbers
+//q: positive integer value, or logical
+//n: positive integer, default value 4
+//Wc: non decreasing vector or scalar, starting from 0 uptill 1, default value 0.5
+//Description
+//This is an Octave function.
+//This function upsamples the signal x by a factor of q, using an order 2*q*n+1 FIR filter.
+//The second argument q must be an integer. The default values of the third and fourth arguments (n, Wc) are 4 and 0.5 respectively.
+//Examples
+//interp(1,2)
+//ans =
+// 0.4792743 0.3626016
+
+//funcprot(0);
+//rhs = argn(2)
+//if(rhs<2 | rhs>4) source code says rhs<1 -- but crashes for just one arg
+//error("Wrong number of input arguments.")
+//end
+//
+//
+//
+//
+// select(rhs)
+// case 2 then
+// y = callOctave("interp",x,q)
+// case 3 then
+// y = callOctave("interp",x,q,n)
+// case 4 then
+// y = callOctave("interp",x,q,n,Wc)
+// end
+//endfunction
+
+
+//........................................................................................................
+// .............................Using pure "Scilab"..........................................
+//.........................................................................................................
+
+//This function is built with the referrence of interp function (taken from interp.m file).
+
+//Octave license:
+
+// Copyright (C) 2000 Paul Kienzle <pkienzle@users.sf.net>
+//
+// This program is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free Software
+// Foundation; either version 3 of the License, or (at your option) any later
+// version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along with
+// this program; if not, see <http://www.gnu.org/licenses/>.
+
+
+
+
+function y = oct_interp(x, q, varargin)
+
+ funcprot(0);
+ [nargout,nargin]=argn();
+
+ if nargin < 1 | nargin > 4,
+ error("Wrong Number of input arguments");
+ end
+ if q ~= fix(q), error("decimate only works with integer q."); end
+
+ if(nargin>2)
+ if(nargin==3)
+ n=varargin(1);
+ Wc=0.5;
+ else
+ n=varargin(1);
+ Wc=varargin(2);
+ end
+ else
+ n=4;Wc=0.5;
+ end
+ if size(x,1)>1
+ y = zeros(length(x)*q+q*n+1,1);
+ else
+ y = zeros(1,length(x)*q+q*n+1);
+ end
+ y(1:q:length(x)*q) = x;
+ b = fir1(2*q*n+1, Wc/q);
+ y=q*fftfilt(b, y);
+ y(1:q*n+1) = []; // adjust for zero filter delay
+
+endfunction
diff --git a/macros/parzenwin.sci b/macros/parzenwin.sci
index f51c924..c8944af 100644
--- a/macros/parzenwin.sci
+++ b/macros/parzenwin.sci
@@ -1,26 +1,38 @@
-function [y] = parzenwin (m)
+function w = parzenwin (m)
//This function returns the filter coefficients of a Parzen window.
//Calling Sequence
-//y = parzenwin (m)
-//Parameters
+//w = parzenwin (m)
+//Parameters
//m: positive integer value
-//y: 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 Parzen window of length m supplied as input, to the output vector y.
+//This function returns the filter coefficients of a Parzen window of length m supplied as input, to the output vector y.
//Examples
//parzenwin(3)
//ans =
-// 0.0740741
-// 1.
// 0.0740741
+// 1.
+// 0.0740741
+
+ funcprot(0);
+ rhs= argn(2);
-rhs = argn(2)
+ if (rhs ~= 1)
+ error("Wrong Number of input arguments");
+ elseif (~ (isscalar (m) & (m == fix (m)) & (m > 0)))
+ error ("parzenwin: M must be a positive integer");
+ end
-if(rhs~=1)
-error("Wrong number of input arguments.")
-end
+ N = m - 1;
+ n = -(N/2):N/2;
+ n1 = n(find(abs(n) <= N/4));
+ n2 = n(find(n > N/4));
+ n3 = n(find(n < (-N/4)));
-y = callOctave("parzenwin",m)
+ w1 = 1 -6.*(abs(n1)./(m/2)).^2 + 6*(abs(n1)./(m/2)).^3;
+ w2 = 2.*(1-abs(n2)./(m/2)).^3;
+ w3 = 2.*(1-abs(n3)./(m/2)).^3;
+ w = [w3 w1 w2]';
endfunction
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
diff --git a/macros/roundn.sci b/macros/roundn.sci
new file mode 100644
index 0000000..87aa25f
--- /dev/null
+++ b/macros/roundn.sci
@@ -0,0 +1,3 @@
+function r=roundn(x,n)
+ r=(round(x*10^n))/(10^n);
+endfunction
diff --git a/macros/triang.sci b/macros/triang.sci
index 6bbca69..f450d97 100644
--- a/macros/triang.sci
+++ b/macros/triang.sci
@@ -1,28 +1,31 @@
-function [y] = triang (m)
+function w = triang (m)
//This function returns the filter coefficients of a triangular window.
//Calling Sequence
-//y = triang (m)
-//Parameters
+//w = triang (m)
+//Parameters
//m: positive integer value
-//y: 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 triangular window of length m supplied as input, to the output vector y.
+//This function returns the filter coefficients of a triangular window of length m supplied as input, to the output vector y.
//Examples
//triang(5)
//ans =
-// 0.3333333
-// 0.6666667
-// 1.
-// 0.6666667
-// 0.3333333
+// 0.3333333
+// 0.6666667
+// 1.
+// 0.6666667
+// 0.3333333
funcprot(0);
rhs = argn(2)
-if(rhs~=1)
-error("Wrong number of input arguments.")
-end
-y = callOctave("triang",m)
+ if(rhs~=1)
+ error("Wrong number of input arguments.")
+ elseif (~ (isscalar (m) & (m == fix (m)) & (m > 0)))
+ error ("parzenwin: M must be a positive integer");
+ end
+
+ w = 1 - abs ([-(m-1):2:(m-1)]' / (m+modulo(m,2)));
endfunction
diff --git a/macros/tukeywin.sci b/macros/tukeywin.sci
index 7ac8641..880f67f 100644
--- a/macros/tukeywin.sci
+++ b/macros/tukeywin.sci
@@ -1,4 +1,6 @@
-function w = tukeywin (m, r)
+// ...................................................Using"callOctave" method...................................................................................
+
+//function w = tukeywin (m, r)
//This function returns the filter coefficients of a Tukey window.
//Calling Sequence
//w = tukeywin (m)
@@ -8,27 +10,76 @@ function w = tukeywin (m, r)
//r: positive real number, between 0 and 1
//Description
//This is an Octave function.
-//This function returns the filter coefficients of a Tukey window of length m supplied as input, to the output vector w.
+//This function returns the filter coefficients of a Tukey window of length m supplied as input, to the output vector w.
//The second parameter r defines the ratio between the constant and cosine section and its value has to be between 0 and 1, with default value 0.5.
//Examples
//tukeywin(5, 2)
//ans =
-// 0.
-// 0.5
-// 1.
-// 0.5
-// 0.
-
-funcprot(0);
-rhs = argn(2)
-if(rhs<1 | rhs>2)
-error("Wrong number of input arguments.")
-end
- select(rhs)
- case 1 then
- w = callOctave("tukeywin",m)
- case 2 then
- w = callOctave("tukeywin",m,r)
- end
-endfunction
+// 0.
+// 0.5
+// 1.
+// 0.5
+// 0.
+
+//funcprot(0);
+//rhs = argn(2)
+//if(rhs<1 | rhs>2)
+//error("Wrong number of input arguments.")
+//end
+// select(rhs)
+// case 1 then
+// w = callOctave("tukeywin",m)
+// case 2 then
+// w = callOctave("tukeywin",m,r)
+// end
+//endfunction
+
+
+
+
+//...................................................................................................................................................................................
+// .....................................................Using pure "Scilab".............................................................................................
+//...................................................................................................................................................................................
+
+
+function w = tukeywin (m, varargin)
+
+ funcprot(0);
+ [nargout,nargin]=argn();
+
+
+ if (nargin < 1 | nargin > 2)
+ error("Wrong Number of input arguments");
+ elseif (~ (isscalar (m) & (m == fix (m)) & (m > 0)))
+ error ("tukeywin: M must be a positive integer");
+ elseif (nargin == 2)
+ // check that 0 < r < 1
+ r=varargin(1);
+ if r > 1
+ r = 1;
+ elseif r < 0
+ r = 0;
+ end
+ else
+ r=0.5;
+ end
+
+ //generate window
+ select(r)
+ case 0,
+ //full box
+ w = ones (m, 1);
+ case 1,
+ // Hanning window
+ w = hanning (m);
+ else
+ // cosine-tapered window
+ t = linspace(0,1,m);
+ t = t(1:$/2)';
+ w = (1 + cos(%pi*(2*t/r-1)))/2;
+ w(floor(r*(m-1)/2)+2:$) = 1;
+ w = [w; ones(modulo(m,2)); w($:-1:1,:)];
+ end
+
+endfunction
diff --git a/macros/txt1_armcov.txt b/macros/txt1_armcov.txt
new file mode 100644
index 0000000..ef0aac9
--- /dev/null
+++ b/macros/txt1_armcov.txt
@@ -0,0 +1,1024 @@
+0.071805
+0.024137
+-0.209469
+-0.616085
+-0.699194
+0.006805
+1.364348
+2.441296
+2.090476
+0.043105
+-2.754550
+-4.581097
+-3.854367
+-0.612870
+3.343929
+5.238121
+3.425945
+-0.939059
+-4.699279
+-5.377784
+-2.322862
+2.426331
+5.732594
+5.215602
+1.255040
+-3.271026
+-4.883426
+-2.373585
+1.857216
+4.238359
+3.100270
+-0.582432
+-3.889775
+-4.054167
+-0.924770
+3.002961
+4.686742
+2.333201
+-2.256881
+-5.842166
+-5.636151
+-1.559192
+3.816647
+6.411896
+4.467232
+-0.467132
+-4.991062
+-5.860661
+-2.478409
+2.856793
+6.463898
+5.672921
+1.254573
+-3.532161
+-5.782328
+-4.434271
+-0.878687
+2.379960
+3.485008
+2.543098
+0.706065
+-0.395913
+-0.147924
+0.401809
+0.113659
+-1.185114
+-2.186115
+-1.604647
+0.738697
+3.615194
+4.884282
+3.290415
+-0.514255
+-4.315402
+-5.604302
+-3.450691
+0.821803
+4.294946
+4.940369
+2.617616
+-0.806592
+-3.251267
+-3.803085
+-2.486833
+-0.272627
+1.647823
+2.747447
+2.922120
+2.338573
+0.487628
+-2.392638
+-4.784552
+-5.060470
+-2.279095
+2.599616
+6.912277
+7.598752
+3.694234
+-2.855279
+-8.156338
+-8.658526
+-3.660373
+3.642348
+8.582116
+8.013678
+2.513254
+-4.147827
+-7.622196
+-6.009692
+-0.857222
+4.211268
+6.023404
+3.783632
+-0.487664
+-3.406710
+-2.878133
+0.403675
+3.864930
+4.443340
+1.264080
+-3.662506
+-6.497144
+-4.876106
+0.210548
+5.211087
+6.685964
+3.692897
+-1.294947
+-4.585023
+-4.053261
+-0.566837
+2.886838
+3.870642
+1.795107
+-1.480030
+-3.477630
+-2.909777
+-0.401874
+2.161080
+2.939490
+1.541755
+-1.123564
+-3.167684
+-3.159115
+-1.019880
+1.947870
+3.455307
+2.179868
+-1.207809
+-4.095898
+-3.848907
+-0.244246
+4.289335
+6.102124
+3.595257
+-1.846254
+-6.405666
+-6.633207
+-2.254448
+3.992823
+7.783692
+6.302163
+0.468379
+-5.768271
+-7.984571
+-4.834949
+1.231260
+6.236066
+6.758350
+2.583705
+-3.082575
+-6.285678
+-4.753322
+-0.004755
+4.301352
+5.139692
+2.097665
+-2.478891
+-5.189945
+-4.292344
+-0.392984
+3.712965
+4.867348
+1.988037
+-2.696299
+-5.728151
+-4.446144
+0.716651
+6.269879
+7.959711
+4.412444
+-2.673929
+-9.058361
+-10.470897
+-5.701118
+2.561384
+9.176199
+10.290568
+5.656697
+-1.721680
+-7.137358
+-7.632746
+-3.358427
+2.154450
+4.891830
+3.298594
+-0.820163
+-4.019923
+-3.892778
+-0.660221
+2.971924
+4.044000
+1.350530
+-3.301877
+-6.232785
+-4.859384
+0.569773
+6.860092
+9.557538
+6.637487
+-0.485941
+-7.376971
+-9.574592
+-5.862903
+1.116873
+6.690056
+7.473230
+3.230042
+-2.855686
+-6.802132
+-6.462788
+-2.588423
+2.219414
+5.491992
+6.113196
+4.602665
+2.026835
+-0.874648
+-3.570812
+-5.413690
+-5.364765
+-2.815285
+1.854187
+6.848359
+9.478717
+7.523217
+1.198601
+-6.161879
+-10.203731
+-8.420107
+-1.940743
+5.244797
+9.016241
+7.363128
+1.749654
+-4.067303
+-6.629145
+-4.748597
+-0.310087
+3.645392
+4.547904
+2.026131
+-1.922190
+-4.038825
+-2.706403
+1.048087
+4.079375
+4.054490
+0.616162
+-3.857003
+-6.252501
+-4.586352
+0.113061
+4.834304
+6.640756
+4.503414
+-0.125765
+-4.446482
+-6.038129
+-4.243765
+-0.448529
+2.982284
+4.376464
+3.384978
+0.889905
+-1.751010
+-3.711769
+-4.490479
+-3.680903
+-1.764410
+0.473859
+2.172079
+2.572631
+1.639004
+-0.065214
+-1.661576
+-2.065917
+-1.165761
+0.116738
+1.056960
+1.515828
+1.825558
+1.566494
+0.165118
+-2.128638
+-4.040424
+-3.965715
+-1.267282
+2.734019
+5.245512
+4.473540
+0.488251
+-4.328090
+-6.840290
+-5.188493
+-0.145465
+5.056552
+6.946477
+4.340470
+-0.973097
+-5.334737
+-5.915844
+-2.464727
+2.527501
+5.776804
+5.219180
+1.289678
+-3.407540
+-5.920821
+-4.786369
+-1.044800
+2.997040
+4.573662
+2.814885
+-0.748528
+-3.501156
+-3.487058
+-0.807279
+2.533580
+4.143582
+3.040826
+-0.102809
+-3.430668
+-4.975112
+-3.511976
+0.158069
+3.418469
+4.249553
+2.278733
+-0.912751
+-2.819243
+-2.266285
+0.063727
+2.377634
+3.087455
+1.866808
+-0.449811
+-2.568125
+-3.155894
+-1.901800
+0.260292
+1.983258
+2.700124
+2.419771
+1.268562
+-0.621299
+-2.323662
+-3.254476
+-2.820639
+-1.081569
+1.273471
+2.964403
+3.003725
+1.194136
+-1.547982
+-3.768287
+-4.234425
+-2.905695
+-0.359683
+2.223901
+3.969501
+4.106299
+2.636278
+0.039642
+-2.952190
+-5.225533
+-5.376177
+-2.911131
+0.849218
+4.104507
+5.410290
+4.533399
+2.216522
+-0.805809
+-3.730022
+-5.253883
+-4.600523
+-1.546188
+2.442131
+5.036557
+4.438628
+0.957268
+-2.748004
+-4.156510
+-2.463612
+0.541662
+2.379933
+1.747327
+-0.324906
+-1.924260
+-1.812342
+-0.019958
+1.664711
+1.448119
+-0.760730
+-3.104241
+-3.360430
+-0.759716
+3.128963
+5.173460
+3.390221
+-1.370382
+-5.697230
+-6.518804
+-3.047789
+2.705159
+6.918398
+6.925229
+2.910201
+-2.511599
+-5.897128
+-5.522504
+-2.008611
+2.201547
+4.429453
+3.258151
+-0.059953
+-2.804963
+-2.927559
+-0.269927
+3.340142
+4.929431
+2.764637
+-2.147022
+-6.144222
+-6.149191
+-1.904820
+3.954826
+7.724571
+6.827345
+1.564924
+-4.718322
+-8.194067
+-6.869055
+-1.890309
+3.700944
+6.934803
+6.549983
+3.379838
+-0.508817
+-3.263163
+-4.036855
+-2.991328
+-0.795729
+1.515974
+2.930007
+3.109695
+1.804149
+-0.668564
+-2.833997
+-3.270972
+-1.717960
+1.031018
+3.456521
+4.747123
+4.163428
+1.422677
+-2.470299
+-5.568986
+-5.997206
+-3.143878
+1.840433
+6.515027
+8.226068
+5.364076
+-1.025463
+-7.311654
+-9.615894
+-6.355001
+0.687231
+7.348262
+9.719746
+6.499013
+-0.126239
+-5.961090
+-7.984108
+-5.388265
+-0.062289
+4.532094
+5.937520
+3.817731
+-0.014182
+-3.062342
+-4.089058
+-3.022826
+-0.597749
+1.730429
+2.905617
+2.642498
+1.200144
+-0.526355
+-1.864714
+-2.266907
+-1.728628
+-0.903399
+-0.489746
+-0.461506
+-0.587771
+-0.432067
+0.237922
+1.101642
+1.471013
+0.542426
+-1.288495
+-2.780632
+-2.581314
+-0.117737
+3.229582
+4.970569
+3.255960
+-1.252325
+-6.181309
+-8.204323
+-5.733215
+0.182871
+6.257331
+8.954419
+6.567443
+0.685842
+-5.219374
+-7.881912
+-6.298805
+-1.811077
+2.947661
+5.858921
+6.123069
+4.383320
+1.698328
+-1.321745
+-4.588951
+-7.194324
+-7.626956
+-4.700853
+1.106812
+7.410957
+10.507566
+7.999593
+0.093311
+-9.396099
+-14.873861
+-12.652845
+-3.001943
+9.588241
+18.156422
+17.390979
+7.236492
+-7.089815
+-18.001807
+-19.749066
+-11.398430
+2.231429
+13.609278
+16.840638
+11.271364
+1.128597
+-7.853619
+-11.536244
+-9.229748
+-3.129262
+3.330949
+7.160932
+7.439568
+5.161515
+1.139106
+-3.855442
+-8.232725
+-9.777808
+-6.888040
+0.087786
+7.874568
+12.036843
+9.909615
+2.709940
+-5.603621
+-10.701390
+-10.047722
+-4.447526
+2.946451
+8.444947
+9.271140
+4.999988
+-1.809216
+-7.260404
+-8.563841
+-5.305766
+0.034607
+4.599034
+6.369065
+5.038051
+1.935210
+-1.185776
+-3.360883
+-4.330545
+-3.975141
+-2.253019
+0.340909
+3.072925
+5.026885
+5.335211
+3.600458
+0.278717
+-3.411513
+-5.827043
+-5.246157
+-1.514442
+3.232036
+6.065590
+5.381459
+1.653607
+-2.823457
+-5.229870
+-4.203712
+-0.811204
+2.414432
+3.231935
+1.551057
+-0.794761
+-2.000667
+-1.070687
+0.914740
+2.189265
+1.934190
+0.466878
+-0.883321
+-0.992586
+0.173505
+1.598150
+2.654664
+2.997998
+2.518525
+0.924459
+-1.529011
+-3.448556
+-3.376319
+-1.028987
+2.065567
+3.813279
+3.451665
+1.318542
+-1.522306
+-3.842719
+-4.674275
+-3.554153
+-0.907569
+2.227215
+4.733725
+5.408496
+3.537264
+-0.456875
+-5.063848
+-7.696047
+-6.617782
+-2.060872
+3.843033
+8.246383
+8.891747
+4.992564
+-1.655787
+-7.701735
+-9.805855
+-6.447713
+0.831652
+8.107600
+10.702569
+6.831535
+-1.483521
+-9.420185
+-12.388093
+-8.063730
+1.266355
+9.684076
+11.995735
+7.274094
+-1.164167
+-8.380139
+-10.272900
+-6.264199
+1.057322
+7.252603
+9.314023
+6.819895
+1.535585
+-3.604579
+-6.464800
+-6.342728
+-4.120619
+-0.831885
+2.209695
+4.149919
+4.231410
+2.337405
+-1.010844
+-4.164645
+-5.156050
+-3.191698
+1.083643
+5.734796
+7.917203
+5.717674
+-0.336322
+-7.277460
+-11.054607
+-9.190200
+-2.374391
+5.679722
+10.252885
+8.680683
+1.992157
+-5.672098
+-9.674405
+-7.420430
+-0.371096
+6.733404
+9.133580
+5.389721
+-1.836835
+-7.832323
+-8.713274
+-4.072083
+2.941711
+7.428166
+6.958128
+2.464882
+-2.474833
+-4.554894
+-3.164560
+0.091669
+2.521154
+2.511512
+0.893443
+-0.650662
+-0.699953
+0.587885
+1.594563
+1.126741
+-1.039171
+-3.414188
+-4.080833
+-2.006031
+1.987620
+5.286174
+5.709439
+2.730908
+-1.873150
+-5.217185
+-5.139387
+-1.800654
+2.354343
+4.172873
+2.812854
+-0.184819
+-2.350103
+-2.191911
+-0.349070
+1.451638
+1.731167
+0.062286
+-2.431716
+-3.932919
+-3.092076
+-0.046053
+3.329843
+5.282510
+4.713046
+1.743398
+-2.425554
+-5.935634
+-6.887422
+-4.398773
+0.736478
+6.227154
+9.269703
+7.984379
+2.411936
+-4.905384
+-9.923203
+-9.806221
+-4.696210
+2.599095
+8.049591
+9.198546
+5.940810
+0.277657
+-5.441737
+-8.798966
+-8.324551
+-4.372918
+1.323876
+6.466143
+9.060756
+7.383854
+1.401692
+-6.308618
+-11.672035
+-11.159256
+-4.255148
+5.882691
+13.472821
+13.943501
+6.419053
+-4.815823
+-13.301062
+-14.348800
+-7.472918
+3.106710
+11.205166
+12.389689
+6.672517
+-1.573259
+-6.990230
+-6.874090
+-2.658234
+1.791166
+3.427680
+1.853307
+-0.631045
+-1.244817
+0.638530
+3.063048
+3.705836
+1.576392
+-2.149306
+-4.996375
+-4.700056
+-1.177428
+3.423694
+5.703858
+3.970623
+-0.728577
+-5.116392
+-5.888652
+-2.423027
+2.818485
+6.146020
+5.121655
+0.921826
+-3.293362
+-5.059887
+-3.847308
+-0.921975
+2.082278
+3.907204
+3.920050
+2.072208
+-1.032001
+-3.928384
+-4.924785
+-3.098762
+0.705388
+3.849504
+3.824726
+0.711682
+-3.245262
+-5.054931
+-3.343795
+0.983876
+4.922686
+5.723344
+2.971302
+-1.327384
+-4.400931
+-4.525754
+-2.023100
+1.204024
+3.179162
+3.373685
+2.366057
+1.039723
+0.083420
+-0.626999
+-1.526212
+-2.889208
+-3.934017
+-2.925489
+0.773754
+5.529773
+8.274129
+6.558779
+1.088844
+-4.773624
+-7.423930
+-5.472098
+-1.056084
+2.620016
+3.639859
+2.276444
+0.265428
+-0.865869
+-0.749419
+-0.196666
+-0.143246
+-0.846052
+-1.792058
+-1.827085
+-0.522472
+1.139359
+1.928159
+1.109208
+-1.045560
+-3.045864
+-3.250575
+-1.167054
+1.889645
+3.975449
+3.694795
+1.207152
+-1.777696
+-3.088311
+-2.237133
+-0.304763
+1.077375
+1.197067
+0.275139
+-0.846067
+-0.911599
+0.153407
+1.595386
+2.074614
+0.983479
+-1.050561
+-2.568776
+-2.473901
+-0.722486
+1.476072
+2.732426
+2.229247
+0.065211
+-2.699929
+-4.561576
+-4.141261
+-1.501353
+2.602531
+6.095484
+6.760030
+3.776275
+-1.050775
+-4.939997
+-5.672465
+-3.079862
+1.059123
+3.836438
+3.254590
+-0.146332
+-3.299443
+-3.441400
+-0.280015
+3.304282
+3.974840
+0.622289
+-4.215029
+-6.177514
+-3.125930
+3.134715
+8.230418
+8.154321
+2.212313
+-5.924296
+-10.475142
+-7.861892
+0.584663
+9.103105
+11.452085
+5.547576
+-4.860564
+-12.439683
+-11.627338
+-2.946040
+7.775549
+13.313280
+9.737261
+-0.148594
+-9.552529
+-12.403692
+-7.343675
+2.067675
+9.688008
+10.681434
+4.472808
+-4.522832
+-10.366947
+-9.372858
+-2.445544
+5.689039
+9.949497
+7.851630
+1.223607
+-5.352422
+-7.478821
+-4.189094
+1.543297
+5.433466
+4.787807
+0.330160
+-4.062554
+-4.777422
+-1.093119
+4.508389
+7.682459
+5.711126
+-0.325744
+-6.118720
+-7.424582
+-3.239110
+3.177230
diff --git a/macros/txt2_decimate.txt b/macros/txt2_decimate.txt
new file mode 100644
index 0000000..2a3e66f
--- /dev/null
+++ b/macros/txt2_decimate.txt
@@ -0,0 +1,1001 @@
+-0.000400
+0.553200
+1.048800
+1.434300
+1.675800
+1.751400
+1.667000
+1.441600
+1.115000
+0.736100
+0.356500
+0.026600
+-0.216300
+-0.348200
+-0.364900
+-0.280300
+-0.123800
+0.062800
+0.234200
+0.346800
+0.366300
+0.273100
+0.065600
+-0.239000
+-0.607000
+-0.992000
+-1.341900
+-1.605600
+-1.740700
+-1.719400
+-1.532400
+-1.191500
+-0.727600
+-0.187400
+0.372600
+0.893300
+1.320700
+1.612800
+1.744800
+1.712100
+1.530100
+1.232400
+0.864900
+0.479900
+0.128400
+-0.146800
+-0.317200
+-0.371700
+-0.318100
+-0.181600
+-0.000000
+0.181600
+0.318100
+0.371700
+0.317200
+0.146800
+-0.128400
+-0.479900
+-0.864900
+-1.232400
+-1.530100
+-1.712100
+-1.744800
+-1.612800
+-1.320700
+-0.893300
+-0.372600
+0.187400
+0.727600
+1.191500
+1.532400
+1.719300
+1.740700
+1.605600
+1.341900
+0.992000
+0.606900
+0.239000
+-0.065700
+-0.273100
+-0.366300
+-0.346800
+-0.234200
+-0.062800
+0.123900
+0.280200
+0.364900
+0.348200
+0.216200
+-0.026500
+-0.356700
+-0.735900
+-1.115100
+-1.441700
+-1.666700
+-1.751900
+-1.675300
+-1.434700
+-1.048500
+-0.553300
+0.000000
+0.553300
+1.048500
+1.434700
+1.675300
+1.751900
+1.666700
+1.441700
+1.115100
+0.735900
+0.356700
+0.026500
+-0.216200
+-0.348200
+-0.364900
+-0.280200
+-0.123900
+0.062800
+0.234200
+0.346800
+0.366300
+0.273100
+0.065700
+-0.239000
+-0.606900
+-0.992000
+-1.341900
+-1.605600
+-1.740700
+-1.719300
+-1.532400
+-1.191500
+-0.727600
+-0.187400
+0.372600
+0.893300
+1.320700
+1.612800
+1.744800
+1.712100
+1.530100
+1.232400
+0.864900
+0.479900
+0.128400
+-0.146800
+-0.317200
+-0.371700
+-0.318100
+-0.181600
+-0.000000
+0.181600
+0.318100
+0.371700
+0.317200
+0.146800
+-0.128400
+-0.479900
+-0.864900
+-1.232400
+-1.530100
+-1.712100
+-1.744800
+-1.612800
+-1.320700
+-0.893300
+-0.372600
+0.187400
+0.727600
+1.191500
+1.532400
+1.719300
+1.740700
+1.605600
+1.341900
+0.992000
+0.606900
+0.239000
+-0.065700
+-0.273100
+-0.366300
+-0.346800
+-0.234200
+-0.062800
+0.123900
+0.280200
+0.364900
+0.348200
+0.216200
+-0.026500
+-0.356700
+-0.735900
+-1.115100
+-1.441700
+-1.666700
+-1.751900
+-1.675300
+-1.434700
+-1.048500
+-0.553300
+-0.000000
+0.553300
+1.048500
+1.434700
+1.675300
+1.751900
+1.666700
+1.441700
+1.115100
+0.735900
+0.356700
+0.026500
+-0.216200
+-0.348200
+-0.364900
+-0.280200
+-0.123900
+0.062800
+0.234200
+0.346800
+0.366300
+0.273100
+0.065700
+-0.239000
+-0.606900
+-0.992000
+-1.341900
+-1.605600
+-1.740700
+-1.719300
+-1.532400
+-1.191500
+-0.727600
+-0.187400
+0.372600
+0.893300
+1.320700
+1.612800
+1.744800
+1.712100
+1.530100
+1.232400
+0.864900
+0.479900
+0.128400
+-0.146800
+-0.317200
+-0.371700
+-0.318100
+-0.181600
+0.000000
+0.181600
+0.318100
+0.371700
+0.317200
+0.146800
+-0.128400
+-0.479900
+-0.864900
+-1.232400
+-1.530100
+-1.712100
+-1.744800
+-1.612800
+-1.320700
+-0.893300
+-0.372600
+0.187400
+0.727600
+1.191500
+1.532400
+1.719300
+1.740700
+1.605600
+1.341900
+0.992000
+0.606900
+0.239000
+-0.065700
+-0.273100
+-0.366300
+-0.346800
+-0.234200
+-0.062800
+0.123900
+0.280200
+0.364900
+0.348200
+0.216200
+-0.026500
+-0.356700
+-0.735900
+-1.115100
+-1.441700
+-1.666700
+-1.751900
+-1.675300
+-1.434700
+-1.048500
+-0.553300
+0.000000
+0.553300
+1.048500
+1.434700
+1.675300
+1.751900
+1.666700
+1.441700
+1.115100
+0.735900
+0.356700
+0.026500
+-0.216200
+-0.348200
+-0.364900
+-0.280200
+-0.123900
+0.062800
+0.234200
+0.346800
+0.366300
+0.273100
+0.065700
+-0.239000
+-0.606900
+-0.992000
+-1.341900
+-1.605600
+-1.740700
+-1.719300
+-1.532400
+-1.191500
+-0.727600
+-0.187400
+0.372600
+0.893300
+1.320700
+1.612800
+1.744800
+1.712100
+1.530100
+1.232400
+0.864900
+0.479900
+0.128400
+-0.146800
+-0.317200
+-0.371700
+-0.318100
+-0.181600
+0.000000
+0.181600
+0.318100
+0.371700
+0.317200
+0.146800
+-0.128400
+-0.479900
+-0.864900
+-1.232400
+-1.530100
+-1.712100
+-1.744800
+-1.612800
+-1.320700
+-0.893300
+-0.372600
+0.187400
+0.727600
+1.191500
+1.532400
+1.719300
+1.740700
+1.605600
+1.341900
+0.992000
+0.606900
+0.239000
+-0.065700
+-0.273100
+-0.366300
+-0.346800
+-0.234200
+-0.062800
+0.123900
+0.280200
+0.364900
+0.348200
+0.216200
+-0.026500
+-0.356700
+-0.735900
+-1.115100
+-1.441700
+-1.666700
+-1.751900
+-1.675300
+-1.434700
+-1.048500
+-0.553300
+0.000000
+0.553300
+1.048500
+1.434700
+1.675300
+1.751900
+1.666700
+1.441700
+1.115100
+0.735900
+0.356700
+0.026500
+-0.216200
+-0.348200
+-0.364900
+-0.280200
+-0.123900
+0.062800
+0.234200
+0.346800
+0.366300
+0.273100
+0.065700
+-0.239000
+-0.606900
+-0.992000
+-1.341900
+-1.605600
+-1.740700
+-1.719300
+-1.532400
+-1.191500
+-0.727600
+-0.187400
+0.372600
+0.893300
+1.320700
+1.612800
+1.744800
+1.712100
+1.530100
+1.232400
+0.864900
+0.479900
+0.128400
+-0.146800
+-0.317200
+-0.371700
+-0.318100
+-0.181600
+-0.000000
+0.181600
+0.318100
+0.371700
+0.317200
+0.146800
+-0.128400
+-0.479900
+-0.864900
+-1.232400
+-1.530100
+-1.712100
+-1.744800
+-1.612800
+-1.320700
+-0.893300
+-0.372600
+0.187400
+0.727600
+1.191500
+1.532400
+1.719300
+1.740700
+1.605600
+1.341900
+0.992000
+0.606900
+0.239000
+-0.065700
+-0.273100
+-0.366300
+-0.346800
+-0.234200
+-0.062800
+0.123900
+0.280200
+0.364900
+0.348200
+0.216200
+-0.026500
+-0.356700
+-0.735900
+-1.115100
+-1.441700
+-1.666700
+-1.751900
+-1.675300
+-1.434700
+-1.048500
+-0.553300
+-0.000000
+0.553300
+1.048500
+1.434700
+1.675300
+1.751900
+1.666700
+1.441700
+1.115100
+0.735900
+0.356700
+0.026500
+-0.216200
+-0.348200
+-0.364900
+-0.280200
+-0.123900
+0.062800
+0.234200
+0.346800
+0.366300
+0.273100
+0.065700
+-0.239000
+-0.606900
+-0.992000
+-1.341900
+-1.605600
+-1.740700
+-1.719300
+-1.532400
+-1.191500
+-0.727600
+-0.187400
+0.372600
+0.893300
+1.320700
+1.612800
+1.744800
+1.712100
+1.530100
+1.232400
+0.864900
+0.479900
+0.128400
+-0.146800
+-0.317200
+-0.371700
+-0.318100
+-0.181600
+-0.000000
+0.181600
+0.318100
+0.371700
+0.317200
+0.146800
+-0.128400
+-0.479900
+-0.864900
+-1.232400
+-1.530100
+-1.712100
+-1.744800
+-1.612800
+-1.320700
+-0.893300
+-0.372600
+0.187400
+0.727600
+1.191500
+1.532400
+1.719300
+1.740700
+1.605600
+1.341900
+0.992000
+0.606900
+0.239000
+-0.065700
+-0.273100
+-0.366300
+-0.346800
+-0.234200
+-0.062800
+0.123900
+0.280200
+0.364900
+0.348200
+0.216200
+-0.026500
+-0.356700
+-0.735900
+-1.115100
+-1.441700
+-1.666700
+-1.751900
+-1.675300
+-1.434700
+-1.048500
+-0.553300
+-0.000000
+0.553300
+1.048500
+1.434700
+1.675300
+1.751900
+1.666700
+1.441700
+1.115100
+0.735900
+0.356700
+0.026500
+-0.216200
+-0.348200
+-0.364900
+-0.280200
+-0.123900
+0.062800
+0.234200
+0.346800
+0.366300
+0.273100
+0.065700
+-0.239000
+-0.606900
+-0.992000
+-1.341900
+-1.605600
+-1.740700
+-1.719300
+-1.532400
+-1.191500
+-0.727600
+-0.187400
+0.372600
+0.893300
+1.320700
+1.612800
+1.744800
+1.712100
+1.530100
+1.232400
+0.864900
+0.479900
+0.128400
+-0.146800
+-0.317200
+-0.371700
+-0.318100
+-0.181600
+-0.000000
+0.181600
+0.318100
+0.371700
+0.317200
+0.146800
+-0.128400
+-0.479900
+-0.864900
+-1.232400
+-1.530100
+-1.712100
+-1.744800
+-1.612800
+-1.320700
+-0.893300
+-0.372600
+0.187400
+0.727600
+1.191500
+1.532400
+1.719300
+1.740700
+1.605600
+1.341900
+0.992000
+0.606900
+0.239000
+-0.065700
+-0.273100
+-0.366300
+-0.346800
+-0.234200
+-0.062800
+0.123900
+0.280200
+0.364900
+0.348200
+0.216200
+-0.026500
+-0.356700
+-0.735900
+-1.115100
+-1.441700
+-1.666700
+-1.751900
+-1.675300
+-1.434700
+-1.048500
+-0.553300
+-0.000000
+0.553300
+1.048500
+1.434700
+1.675300
+1.751900
+1.666700
+1.441700
+1.115100
+0.735900
+0.356700
+0.026500
+-0.216200
+-0.348200
+-0.364900
+-0.280200
+-0.123900
+0.062800
+0.234200
+0.346800
+0.366300
+0.273100
+0.065700
+-0.239000
+-0.606900
+-0.992000
+-1.341900
+-1.605600
+-1.740700
+-1.719300
+-1.532400
+-1.191500
+-0.727600
+-0.187400
+0.372600
+0.893300
+1.320700
+1.612800
+1.744800
+1.712100
+1.530100
+1.232400
+0.864900
+0.479900
+0.128400
+-0.146800
+-0.317200
+-0.371700
+-0.318100
+-0.181600
+-0.000000
+0.181600
+0.318100
+0.371700
+0.317200
+0.146800
+-0.128400
+-0.479900
+-0.864900
+-1.232400
+-1.530100
+-1.712100
+-1.744800
+-1.612800
+-1.320700
+-0.893300
+-0.372600
+0.187400
+0.727600
+1.191500
+1.532400
+1.719300
+1.740700
+1.605600
+1.341900
+0.992000
+0.606900
+0.239000
+-0.065700
+-0.273100
+-0.366300
+-0.346800
+-0.234200
+-0.062800
+0.123900
+0.280200
+0.364900
+0.348200
+0.216200
+-0.026500
+-0.356700
+-0.735900
+-1.115100
+-1.441700
+-1.666700
+-1.751900
+-1.675300
+-1.434700
+-1.048500
+-0.553300
+0.000000
+0.553300
+1.048500
+1.434700
+1.675300
+1.751900
+1.666700
+1.441700
+1.115100
+0.735900
+0.356700
+0.026500
+-0.216200
+-0.348200
+-0.364900
+-0.280200
+-0.123900
+0.062800
+0.234200
+0.346800
+0.366300
+0.273100
+0.065700
+-0.239000
+-0.606900
+-0.992000
+-1.341900
+-1.605600
+-1.740700
+-1.719300
+-1.532400
+-1.191500
+-0.727600
+-0.187400
+0.372600
+0.893300
+1.320700
+1.612800
+1.744800
+1.712100
+1.530100
+1.232400
+0.864900
+0.479900
+0.128400
+-0.146800
+-0.317200
+-0.371700
+-0.318100
+-0.181600
+0.000000
+0.181600
+0.318100
+0.371700
+0.317200
+0.146800
+-0.128400
+-0.479900
+-0.864900
+-1.232400
+-1.530100
+-1.712100
+-1.744800
+-1.612800
+-1.320700
+-0.893300
+-0.372600
+0.187400
+0.727600
+1.191500
+1.532400
+1.719300
+1.740700
+1.605600
+1.341900
+0.992000
+0.606900
+0.239000
+-0.065700
+-0.273100
+-0.366300
+-0.346800
+-0.234200
+-0.062800
+0.123900
+0.280200
+0.364900
+0.348200
+0.216200
+-0.026500
+-0.356700
+-0.735900
+-1.115100
+-1.441700
+-1.666700
+-1.751900
+-1.675300
+-1.434700
+-1.048500
+-0.553300
+0.000000
+0.553300
+1.048500
+1.434700
+1.675300
+1.751900
+1.666700
+1.441700
+1.115100
+0.735900
+0.356700
+0.026500
+-0.216200
+-0.348200
+-0.364900
+-0.280200
+-0.123900
+0.062800
+0.234200
+0.346800
+0.366300
+0.273100
+0.065700
+-0.239000
+-0.606900
+-0.992000
+-1.341900
+-1.605600
+-1.740700
+-1.719300
+-1.532400
+-1.191500
+-0.727600
+-0.187400
+0.372600
+0.893300
+1.320700
+1.612800
+1.744800
+1.712100
+1.530100
+1.232400
+0.864900
+0.479900
+0.128400
+-0.146800
+-0.317200
+-0.371700
+-0.318100
+-0.181600
+0.000000
+0.181600
+0.318100
+0.371700
+0.317200
+0.146800
+-0.128400
+-0.479900
+-0.864900
+-1.232400
+-1.530100
+-1.712100
+-1.744800
+-1.612800
+-1.320700
+-0.893300
+-0.372600
+0.187400
+0.727600
+1.191500
+1.532400
+1.719400
+1.740700
+1.605600
+1.341900
+0.991900
+0.607000
+0.238900
+-0.065600
+-0.273100
+-0.366400
+-0.346600
+-0.234400
+-0.062600
+0.123800
+0.280100
+0.365200
+0.347700
+0.216800
+-0.027100
+-0.356300
+-0.735800
+-1.115800
+-1.440400
+-1.668400
+-1.750000
+-1.676900
+-1.434400
+-1.046300
+-0.557400
+0.007600
diff --git a/macros/txt3_helperHDA.txt b/macros/txt3_helperHDA.txt
new file mode 100644
index 0000000..6007f20
--- /dev/null
+++ b/macros/txt3_helperHDA.txt
@@ -0,0 +1,2206 @@
+0.025000
+0.587000
+1.103000
+1.531000
+1.837000
+1.997000
+1.999000
+1.842000
+1.540000
+1.115000
+0.601000
+0.039000
+-0.523000
+-1.041000
+-1.471000
+-1.780000
+-1.944000
+-1.950000
+-1.798000
+-1.499000
+-1.077000
+-0.564000
+-0.003000
+0.560000
+1.079000
+1.512000
+1.825000
+1.992000
+2.002000
+1.854000
+1.558000
+1.139000
+0.628000
+0.068000
+-0.496000
+-1.017000
+-1.452000
+-1.768000
+-1.939000
+-1.953000
+-1.809000
+-1.517000
+-1.100000
+-0.591000
+-0.032000
+0.532000
+1.055000
+1.493000
+1.812000
+1.988000
+2.006000
+1.865000
+1.576000
+1.162000
+0.655000
+0.096000
+-0.468000
+-0.992000
+-1.433000
+-1.755000
+-1.934000
+-1.956000
+-1.820000
+-1.535000
+-1.123000
+-0.618000
+-0.060000
+0.505000
+1.030000
+1.474000
+1.800000
+1.982000
+2.008000
+1.876000
+1.594000
+1.185000
+0.682000
+0.125000
+-0.441000
+-0.968000
+-1.414000
+-1.743000
+-1.929000
+-1.959000
+-1.830000
+-1.552000
+-1.147000
+-0.645000
+-0.089000
+0.477000
+1.006000
+1.454000
+1.786000
+1.977000
+2.011000
+1.886000
+1.611000
+1.208000
+0.709000
+0.153000
+-0.413000
+-0.943000
+-1.394000
+-1.729000
+-1.923000
+-1.961000
+-1.840000
+-1.569000
+-1.169000
+-0.672000
+-0.117000
+0.449000
+0.981000
+1.434000
+1.773000
+1.971000
+2.013000
+1.896000
+1.628000
+1.231000
+0.735000
+0.182000
+-0.385000
+-0.918000
+-1.374000
+-1.716000
+-1.917000
+-1.963000
+-1.850000
+-1.586000
+-1.192000
+-0.699000
+-0.146000
+0.421000
+0.956000
+1.414000
+1.759000
+1.965000
+2.015000
+1.905000
+1.645000
+1.253000
+0.762000
+0.210000
+-0.357000
+-0.893000
+-1.353000
+-1.702000
+-1.911000
+-1.965000
+-1.859000
+-1.603000
+-1.214000
+-0.725000
+-0.174000
+0.393000
+0.930000
+1.393000
+1.745000
+1.958000
+2.016000
+1.915000
+1.661000
+1.276000
+0.788000
+0.238000
+-0.329000
+-0.868000
+-1.333000
+-1.687000
+-1.904000
+-1.966000
+-1.868000
+-1.619000
+-1.237000
+-0.751000
+-0.202000
+0.365000
+0.905000
+1.373000
+1.731000
+1.951000
+2.017000
+1.923000
+1.677000
+1.298000
+0.815000
+0.267000
+-0.301000
+-0.842000
+-1.312000
+-1.673000
+-1.897000
+-1.967000
+-1.877000
+-1.635000
+-1.258000
+-0.777000
+-0.231000
+0.337000
+0.879000
+1.352000
+1.716000
+1.944000
+2.018000
+1.932000
+1.693000
+1.319000
+0.841000
+0.295000
+-0.273000
+-0.816000
+-1.291000
+-1.658000
+-1.889000
+-1.967000
+-1.885000
+-1.650000
+-1.280000
+-0.803000
+-0.259000
+0.309000
+0.854000
+1.330000
+1.701000
+1.936000
+2.018000
+1.940000
+1.708000
+1.341000
+0.866000
+0.323000
+-0.245000
+-0.790000
+-1.269000
+-1.643000
+-1.881000
+-1.967000
+-1.893000
+-1.665000
+-1.301000
+-0.829000
+-0.287000
+0.281000
+0.828000
+1.309000
+1.685000
+1.928000
+2.017000
+1.947000
+1.723000
+1.362000
+0.892000
+0.351000
+-0.217000
+-0.764000
+-1.247000
+-1.627000
+-1.873000
+-1.966000
+-1.901000
+-1.680000
+-1.322000
+-0.855000
+-0.315000
+0.252000
+0.801000
+1.287000
+1.669000
+1.919000
+2.017000
+1.955000
+1.738000
+1.383000
+0.918000
+0.379000
+-0.188000
+-0.738000
+-1.226000
+-1.611000
+-1.864000
+-1.965000
+-1.908000
+-1.695000
+-1.343000
+-0.880000
+-0.343000
+0.224000
+0.775000
+1.265000
+1.653000
+1.910000
+2.016000
+1.962000
+1.752000
+1.404000
+0.943000
+0.407000
+-0.160000
+-0.712000
+-1.203000
+-1.595000
+-1.855000
+-1.964000
+-1.914000
+-1.709000
+-1.364000
+-0.906000
+-0.371000
+0.196000
+0.749000
+1.242000
+1.637000
+1.901000
+2.014000
+1.968000
+1.766000
+1.424000
+0.968000
+0.435000
+-0.132000
+-0.685000
+-1.181000
+-1.578000
+-1.845000
+-1.962000
+-1.921000
+-1.723000
+-1.384000
+-0.931000
+-0.399000
+0.167000
+0.722000
+1.220000
+1.620000
+1.891000
+2.012000
+1.974000
+1.780000
+1.444000
+0.993000
+0.463000
+-0.103000
+-0.659000
+-1.158000
+-1.561000
+-1.835000
+-1.960000
+-1.926000
+-1.736000
+-1.404000
+-0.955000
+-0.427000
+0.139000
+0.695000
+1.197000
+1.603000
+1.881000
+2.010000
+1.980000
+1.793000
+1.464000
+1.018000
+0.491000
+-0.075000
+-0.632000
+-1.135000
+-1.544000
+-1.825000
+-1.958000
+-1.932000
+-1.749000
+-1.423000
+-0.980000
+-0.455000
+0.110000
+0.668000
+1.174000
+1.585000
+1.870000
+2.007000
+1.985000
+1.806000
+1.483000
+1.042000
+0.518000
+-0.046000
+-0.605000
+-1.112000
+-1.526000
+-1.814000
+-1.955000
+-1.937000
+-1.762000
+-1.443000
+-1.005000
+-0.482000
+0.082000
+0.641000
+1.150000
+1.567000
+1.859000
+2.004000
+1.990000
+1.818000
+1.503000
+1.067000
+0.546000
+-0.018000
+-0.578000
+-1.088000
+-1.508000
+-1.803000
+-1.952000
+-1.942000
+-1.774000
+-1.462000
+-1.029000
+-0.510000
+0.053000
+0.614000
+1.127000
+1.549000
+1.848000
+2.000000
+1.994000
+1.831000
+1.521000
+1.091000
+0.573000
+0.011000
+-0.551000
+-1.065000
+-1.490000
+-1.792000
+-1.948000
+-1.946000
+-1.786000
+-1.480000
+-1.053000
+-0.537000
+0.025000
+0.587000
+1.103000
+1.531000
+1.837000
+1.997000
+1.999000
+1.842000
+1.540000
+1.115000
+0.601000
+0.039000
+-0.523000
+-1.041000
+-1.471000
+-1.780000
+-1.944000
+-1.950000
+-1.798000
+-1.499000
+-1.077000
+-0.564000
+-0.003000
+0.560000
+1.079000
+1.512000
+1.825000
+1.992000
+2.002000
+1.854000
+1.558000
+1.139000
+0.628000
+0.068000
+-0.496000
+-1.017000
+-1.452000
+-1.768000
+-1.939000
+-1.953000
+-1.809000
+-1.517000
+-1.100000
+-0.591000
+-0.032000
+0.532000
+1.055000
+1.493000
+1.812000
+1.988000
+2.006000
+1.865000
+1.576000
+1.162000
+0.655000
+0.096000
+-0.468000
+-0.992000
+-1.433000
+-1.755000
+-1.934000
+-1.956000
+-1.820000
+-1.535000
+-1.123000
+-0.618000
+-0.060000
+0.505000
+1.030000
+1.474000
+1.800000
+1.982000
+2.008000
+1.876000
+1.594000
+1.185000
+0.682000
+0.125000
+-0.441000
+-0.968000
+-1.414000
+-1.743000
+-1.929000
+-1.959000
+-1.830000
+-1.552000
+-1.147000
+-0.645000
+-0.089000
+0.477000
+1.006000
+1.454000
+1.786000
+1.977000
+2.011000
+1.886000
+1.611000
+1.208000
+0.709000
+0.153000
+-0.413000
+-0.943000
+-1.394000
+-1.729000
+-1.923000
+-1.961000
+-1.840000
+-1.569000
+-1.169000
+-0.672000
+-0.117000
+0.449000
+0.981000
+1.434000
+1.773000
+1.971000
+2.013000
+1.896000
+1.628000
+1.231000
+0.735000
+0.182000
+-0.385000
+-0.918000
+-1.374000
+-1.716000
+-1.917000
+-1.963000
+-1.850000
+-1.586000
+-1.192000
+-0.699000
+-0.146000
+0.421000
+0.956000
+1.414000
+1.759000
+1.965000
+2.015000
+1.905000
+1.645000
+1.253000
+0.762000
+0.210000
+-0.357000
+-0.893000
+-1.353000
+-1.702000
+-1.911000
+-1.965000
+-1.859000
+-1.603000
+-1.214000
+-0.725000
+-0.174000
+0.393000
+0.930000
+1.393000
+1.745000
+1.958000
+2.016000
+1.915000
+1.661000
+1.276000
+0.788000
+0.238000
+-0.329000
+-0.868000
+-1.333000
+-1.687000
+-1.904000
+-1.966000
+-1.868000
+-1.619000
+-1.237000
+-0.751000
+-0.202000
+0.365000
+0.905000
+1.373000
+1.731000
+1.951000
+2.017000
+1.923000
+1.677000
+1.298000
+0.815000
+0.267000
+-0.301000
+-0.842000
+-1.312000
+-1.673000
+-1.897000
+-1.967000
+-1.877000
+-1.635000
+-1.258000
+-0.777000
+-0.231000
+0.337000
+0.879000
+1.352000
+1.716000
+1.944000
+2.018000
+1.932000
+1.693000
+1.319000
+0.841000
+0.295000
+-0.273000
+-0.816000
+-1.291000
+-1.658000
+-1.889000
+-1.967000
+-1.885000
+-1.650000
+-1.280000
+-0.803000
+-0.259000
+0.309000
+0.854000
+1.330000
+1.701000
+1.936000
+2.018000
+1.940000
+1.708000
+1.341000
+0.866000
+0.323000
+-0.245000
+-0.790000
+-1.269000
+-1.643000
+-1.881000
+-1.967000
+-1.893000
+-1.665000
+-1.301000
+-0.829000
+-0.287000
+0.281000
+0.828000
+1.309000
+1.685000
+1.928000
+2.017000
+1.947000
+1.723000
+1.362000
+0.892000
+0.351000
+-0.217000
+-0.764000
+-1.247000
+-1.627000
+-1.873000
+-1.966000
+-1.901000
+-1.680000
+-1.322000
+-0.855000
+-0.315000
+0.252000
+0.801000
+1.287000
+1.669000
+1.919000
+2.017000
+1.955000
+1.738000
+1.383000
+0.918000
+0.379000
+-0.188000
+-0.738000
+-1.226000
+-1.611000
+-1.864000
+-1.965000
+-1.908000
+-1.695000
+-1.343000
+-0.880000
+-0.343000
+0.224000
+0.775000
+1.265000
+1.653000
+1.910000
+2.016000
+1.962000
+1.752000
+1.404000
+0.943000
+0.407000
+-0.160000
+-0.712000
+-1.203000
+-1.595000
+-1.855000
+-1.964000
+-1.914000
+-1.709000
+-1.364000
+-0.906000
+-0.371000
+0.196000
+0.749000
+1.242000
+1.637000
+1.901000
+2.014000
+1.968000
+1.766000
+1.424000
+0.968000
+0.435000
+-0.132000
+-0.685000
+-1.181000
+-1.578000
+-1.845000
+-1.962000
+-1.921000
+-1.723000
+-1.384000
+-0.931000
+-0.399000
+0.167000
+0.722000
+1.220000
+1.620000
+1.891000
+2.012000
+1.974000
+1.780000
+1.444000
+0.993000
+0.463000
+-0.103000
+-0.659000
+-1.158000
+-1.561000
+-1.835000
+-1.960000
+-1.926000
+-1.736000
+-1.404000
+-0.955000
+-0.427000
+0.139000
+0.695000
+1.197000
+1.603000
+1.881000
+2.010000
+1.980000
+1.793000
+1.464000
+1.018000
+0.491000
+-0.075000
+-0.632000
+-1.135000
+-1.544000
+-1.825000
+-1.958000
+-1.932000
+-1.749000
+-1.423000
+-0.980000
+-0.455000
+0.110000
+0.668000
+1.174000
+1.585000
+1.870000
+2.007000
+1.985000
+1.806000
+1.483000
+1.042000
+0.518000
+-0.046000
+-0.605000
+-1.112000
+-1.526000
+-1.814000
+-1.955000
+-1.937000
+-1.762000
+-1.443000
+-1.005000
+-0.482000
+0.082000
+0.641000
+1.150000
+1.567000
+1.859000
+2.004000
+1.990000
+1.818000
+1.503000
+1.067000
+0.546000
+-0.018000
+-0.578000
+-1.088000
+-1.508000
+-1.803000
+-1.952000
+-1.942000
+-1.774000
+-1.462000
+-1.029000
+-0.510000
+0.053000
+0.614000
+1.127000
+1.549000
+1.848000
+2.000000
+1.994000
+1.831000
+1.521000
+1.091000
+0.573000
+0.011000
+-0.551000
+-1.065000
+-1.490000
+-1.792000
+-1.948000
+-1.946000
+-1.786000
+-1.480000
+-1.053000
+-0.537000
+0.025000
+0.587000
+1.103000
+1.531000
+1.837000
+1.997000
+1.999000
+1.842000
+1.540000
+1.115000
+0.601000
+0.039000
+-0.523000
+-1.041000
+-1.471000
+-1.780000
+-1.944000
+-1.950000
+-1.798000
+-1.499000
+-1.077000
+-0.564000
+-0.003000
+0.560000
+1.079000
+1.512000
+1.825000
+1.992000
+2.002000
+1.854000
+1.558000
+1.139000
+0.628000
+0.068000
+-0.496000
+-1.017000
+-1.452000
+-1.768000
+-1.939000
+-1.953000
+-1.809000
+-1.517000
+-1.100000
+-0.591000
+-0.032000
+0.532000
+1.055000
+1.493000
+1.812000
+1.988000
+2.006000
+1.865000
+1.576000
+1.162000
+0.655000
+0.096000
+-0.468000
+-0.992000
+-1.433000
+-1.755000
+-1.934000
+-1.956000
+-1.820000
+-1.535000
+-1.123000
+-0.618000
+-0.060000
+0.505000
+1.030000
+1.474000
+1.800000
+1.982000
+2.008000
+1.876000
+1.594000
+1.185000
+0.682000
+0.125000
+-0.441000
+-0.968000
+-1.414000
+-1.743000
+-1.929000
+-1.959000
+-1.830000
+-1.552000
+-1.147000
+-0.645000
+-0.089000
+0.477000
+1.006000
+1.454000
+1.786000
+1.977000
+2.011000
+1.886000
+1.611000
+1.208000
+0.709000
+0.153000
+-0.413000
+-0.943000
+-1.394000
+-1.729000
+-1.923000
+-1.961000
+-1.840000
+-1.569000
+-1.169000
+-0.672000
+-0.117000
+0.449000
+0.981000
+1.434000
+1.773000
+1.971000
+2.013000
+1.896000
+1.628000
+1.231000
+0.735000
+0.182000
+-0.385000
+-0.918000
+-1.374000
+-1.716000
+-1.917000
+-1.963000
+-1.850000
+-1.586000
+-1.192000
+-0.699000
+-0.146000
+0.421000
+0.956000
+1.414000
+1.759000
+1.965000
+2.015000
+1.905000
+1.645000
+1.253000
+0.762000
+0.210000
+-0.357000
+-0.893000
+-1.353000
+-1.702000
+-1.911000
+-1.965000
+-1.859000
+-1.603000
+-1.214000
+-0.725000
+-0.174000
+0.393000
+0.930000
+1.393000
+1.745000
+1.958000
+2.016000
+1.915000
+1.661000
+1.276000
+0.788000
+0.238000
+-0.329000
+-0.868000
+-1.333000
+-1.687000
+-1.904000
+-1.966000
+-1.868000
+-1.619000
+-1.237000
+-0.751000
+-0.202000
+0.365000
+0.905000
+1.373000
+1.731000
+1.951000
+2.017000
+1.923000
+1.677000
+1.298000
+0.815000
+0.267000
+-0.301000
+-0.842000
+-1.312000
+-1.673000
+-1.897000
+-1.967000
+-1.877000
+-1.635000
+-1.258000
+-0.777000
+-0.231000
+0.337000
+0.879000
+1.352000
+1.716000
+1.944000
+2.018000
+1.932000
+1.693000
+1.319000
+0.841000
+0.295000
+-0.273000
+-0.816000
+-1.291000
+-1.658000
+-1.889000
+-1.967000
+-1.885000
+-1.650000
+-1.280000
+-0.803000
+-0.259000
+0.309000
+0.854000
+1.330000
+1.701000
+1.936000
+2.018000
+1.940000
+1.708000
+1.341000
+0.866000
+0.323000
+-0.245000
+-0.790000
+-1.269000
+-1.643000
+-1.881000
+-1.967000
+-1.893000
+-1.665000
+-1.301000
+-0.829000
+-0.287000
+0.281000
+0.828000
+1.309000
+1.685000
+1.928000
+2.017000
+1.947000
+1.723000
+1.362000
+0.892000
+0.351000
+-0.217000
+-0.764000
+-1.247000
+-1.627000
+-1.873000
+-1.966000
+-1.901000
+-1.680000
+-1.322000
+-0.855000
+-0.315000
+0.252000
+0.801000
+1.287000
+1.669000
+1.919000
+2.017000
+1.955000
+1.738000
+1.383000
+0.918000
+0.379000
+-0.188000
+-0.738000
+-1.226000
+-1.611000
+-1.864000
+-1.965000
+-1.908000
+-1.695000
+-1.343000
+-0.880000
+-0.343000
+0.224000
+0.775000
+1.265000
+1.653000
+1.910000
+2.016000
+1.962000
+1.752000
+1.404000
+0.943000
+0.407000
+-0.160000
+-0.712000
+-1.203000
+-1.595000
+-1.855000
+-1.964000
+-1.914000
+-1.709000
+-1.364000
+-0.906000
+-0.371000
+0.196000
+0.749000
+1.242000
+1.637000
+1.901000
+2.014000
+1.968000
+1.766000
+1.424000
+0.968000
+0.435000
+-0.132000
+-0.685000
+-1.181000
+-1.578000
+-1.845000
+-1.962000
+-1.921000
+-1.723000
+-1.384000
+-0.931000
+-0.399000
+0.167000
+0.722000
+1.220000
+1.620000
+1.891000
+2.012000
+1.974000
+1.780000
+1.444000
+0.993000
+0.463000
+-0.103000
+-0.659000
+-1.158000
+-1.561000
+-1.835000
+-1.960000
+-1.926000
+-1.736000
+-1.404000
+-0.955000
+-0.427000
+0.139000
+0.695000
+1.197000
+1.603000
+1.881000
+2.010000
+1.980000
+1.793000
+1.464000
+1.018000
+0.491000
+-0.075000
+-0.632000
+-1.135000
+-1.544000
+-1.825000
+-1.958000
+-1.932000
+-1.749000
+-1.423000
+-0.980000
+-0.455000
+0.110000
+0.668000
+1.174000
+1.585000
+1.870000
+2.007000
+1.985000
+1.806000
+1.483000
+1.042000
+0.518000
+-0.046000
+-0.605000
+-1.112000
+-1.526000
+-1.814000
+-1.955000
+-1.937000
+-1.762000
+-1.443000
+-1.005000
+-0.482000
+0.082000
+0.641000
+1.150000
+1.567000
+1.859000
+2.004000
+1.990000
+1.818000
+1.503000
+1.067000
+0.546000
+-0.018000
+-0.578000
+-1.088000
+-1.508000
+-1.803000
+-1.952000
+-1.942000
+-1.774000
+-1.462000
+-1.029000
+-0.510000
+0.053000
+0.614000
+1.127000
+1.549000
+1.848000
+2.000000
+1.994000
+1.831000
+1.521000
+1.091000
+0.573000
+0.011000
+-0.551000
+-1.065000
+-1.490000
+-1.792000
+-1.948000
+-1.946000
+-1.786000
+-1.480000
+-1.053000
+-0.537000
+0.025000
+0.587000
+1.103000
+1.531000
+1.837000
+1.997000
+1.999000
+1.842000
+1.540000
+1.115000
+0.601000
+0.039000
+-0.523000
+-1.041000
+-1.471000
+-1.780000
+-1.944000
+-1.950000
+-1.798000
+-1.499000
+-1.077000
+-0.564000
+-0.003000
+0.560000
+1.079000
+1.512000
+1.825000
+1.992000
+2.002000
+1.854000
+1.558000
+1.139000
+0.628000
+0.068000
+-0.496000
+-1.017000
+-1.452000
+-1.768000
+-1.939000
+-1.953000
+-1.809000
+-1.517000
+-1.100000
+-0.591000
+-0.032000
+0.532000
+1.055000
+1.493000
+1.812000
+1.988000
+2.006000
+1.865000
+1.576000
+1.162000
+0.655000
+0.096000
+-0.468000
+-0.992000
+-1.433000
+-1.755000
+-1.934000
+-1.956000
+-1.820000
+-1.535000
+-1.123000
+-0.618000
+-0.060000
+0.505000
+1.030000
+1.474000
+1.800000
+1.982000
+2.008000
+1.876000
+1.594000
+1.185000
+0.682000
+0.125000
+-0.441000
+-0.968000
+-1.414000
+-1.743000
+-1.929000
+-1.959000
+-1.830000
+-1.552000
+-1.147000
+-0.645000
+-0.089000
+0.477000
+1.006000
+1.454000
+1.786000
+1.977000
+2.011000
+1.886000
+1.611000
+1.208000
+0.709000
+0.153000
+-0.413000
+-0.943000
+-1.394000
+-1.729000
+-1.923000
+-1.961000
+-1.840000
+-1.569000
+-1.169000
+-0.672000
+-0.117000
+0.449000
+0.981000
+1.434000
+1.773000
+1.971000
+2.013000
+1.896000
+1.628000
+1.231000
+0.735000
+0.182000
+-0.385000
+-0.918000
+-1.374000
+-1.716000
+-1.917000
+-1.963000
+-1.850000
+-1.586000
+-1.192000
+-0.699000
+-0.146000
+0.421000
+0.956000
+1.414000
+1.759000
+1.965000
+2.015000
+1.905000
+1.645000
+1.253000
+0.762000
+0.210000
+-0.357000
+-0.893000
+-1.353000
+-1.702000
+-1.911000
+-1.965000
+-1.859000
+-1.603000
+-1.214000
+-0.725000
+-0.174000
+0.393000
+0.930000
+1.393000
+1.745000
+1.958000
+2.016000
+1.915000
+1.661000
+1.276000
+0.788000
+0.238000
+-0.329000
+-0.868000
+-1.333000
+-1.687000
+-1.904000
+-1.966000
+-1.868000
+-1.619000
+-1.237000
+-0.751000
+-0.202000
+0.365000
+0.905000
+1.373000
+1.731000
+1.951000
+2.017000
+1.923000
+1.677000
+1.298000
+0.815000
+0.267000
+-0.301000
+-0.842000
+-1.312000
+-1.673000
+-1.897000
+-1.967000
+-1.877000
+-1.635000
+-1.258000
+-0.777000
+-0.231000
+0.337000
+0.879000
+1.352000
+1.716000
+1.944000
+2.018000
+1.932000
+1.693000
+1.319000
+0.841000
+0.295000
+-0.273000
+-0.816000
+-1.291000
+-1.658000
+-1.889000
+-1.967000
+-1.885000
+-1.650000
+-1.280000
+-0.803000
+-0.259000
+0.309000
+0.854000
+1.330000
+1.701000
+1.936000
+2.018000
+1.940000
+1.708000
+1.341000
+0.866000
+0.323000
+-0.245000
+-0.790000
+-1.269000
+-1.643000
+-1.881000
+-1.967000
+-1.893000
+-1.665000
+-1.301000
+-0.829000
+-0.287000
+0.281000
+0.828000
+1.309000
+1.685000
+1.928000
+2.017000
+1.947000
+1.723000
+1.362000
+0.892000
+0.351000
+-0.217000
+-0.764000
+-1.247000
+-1.627000
+-1.873000
+-1.966000
+-1.901000
+-1.680000
+-1.322000
+-0.855000
+-0.315000
+0.252000
+0.801000
+1.287000
+1.669000
+1.919000
+2.017000
+1.955000
+1.738000
+1.383000
+0.918000
+0.379000
+-0.188000
+-0.738000
+-1.226000
+-1.611000
+-1.864000
+-1.965000
+-1.908000
+-1.695000
+-1.343000
+-0.880000
+-0.343000
+0.224000
+0.775000
+1.265000
+1.653000
+1.910000
+2.016000
+1.962000
+1.752000
+1.404000
+0.943000
+0.407000
+-0.160000
+-0.712000
+-1.203000
+-1.595000
+-1.855000
+-1.964000
+-1.914000
+-1.709000
+-1.364000
+-0.906000
+-0.371000
+0.196000
+0.749000
+1.242000
+1.637000
+1.901000
+2.014000
+1.968000
+1.766000
+1.424000
+0.968000
+0.435000
+-0.132000
+-0.685000
+-1.181000
+-1.578000
+-1.845000
+-1.962000
+-1.921000
+-1.723000
+-1.384000
+-0.931000
+-0.399000
+0.167000
+0.722000
+1.220000
+1.620000
+1.891000
+2.012000
+1.974000
+1.780000
+1.444000
+0.993000
+0.463000
+-0.103000
+-0.659000
+-1.158000
+-1.561000
+-1.835000
+-1.960000
+-1.926000
+-1.736000
+-1.404000
+-0.955000
+-0.427000
+0.139000
+0.695000
+1.197000
+1.603000
+1.881000
+2.010000
+1.980000
+1.793000
+1.464000
+1.018000
+0.491000
+-0.075000
+-0.632000
+-1.135000
+-1.544000
+-1.825000
+-1.958000
+-1.932000
+-1.749000
+-1.423000
+-0.980000
+-0.455000
+0.110000
+0.668000
+1.174000
+1.585000
+1.870000
+2.007000
+1.985000
+1.806000
+1.483000
+1.042000
+0.518000
+-0.046000
+-0.605000
+-1.112000
+-1.526000
+-1.814000
+-1.955000
+-1.937000
+-1.762000
+-1.443000
+-1.005000
+-0.482000
+0.082000
+0.641000
+1.150000
+1.567000
+1.859000
+2.004000
+1.990000
+1.818000
+1.503000
+1.067000
+0.546000
+-0.018000
+-0.578000
+-1.088000
+-1.508000
+-1.803000
+-1.952000
+-1.942000
+-1.774000
+-1.462000
+-1.029000
+-0.510000
+0.053000
+0.614000
+1.127000
+1.549000
+1.848000
+2.000000
+1.994000
+1.831000
+1.521000
+1.091000
+0.573000
+0.011000
+-0.551000
+-1.065000
+-1.490000
+-1.792000
+-1.948000
+-1.946000
+-1.786000
+-1.480000
+-1.053000
+-0.537000
+0.025000
+0.587000
+1.103000
+1.531000
+1.837000
+1.997000
+1.999000
+1.842000
+1.540000
+1.115000
+0.601000
+0.039000
+-0.523000
+-1.041000
+-1.471000
+-1.780000
+-1.944000
+-1.950000
+-1.798000
+-1.499000
+-1.077000
+-0.564000
+-0.003000
+0.560000
+1.079000
+1.512000
+1.825000
+1.992000
+2.002000
+1.854000
+1.558000
+1.139000
+0.628000
+0.068000
+-0.496000
+-1.017000
+-1.452000
+-1.768000
+-1.939000
+-1.953000
+-1.809000
+-1.517000
+-1.100000
+-0.591000
+-0.032000
+0.532000
+1.055000
+1.493000
+1.812000
+1.988000
+2.006000
+1.865000
+1.576000
+1.162000
+0.655000
+0.096000
+-0.468000
+-0.992000
+-1.433000
+-1.755000
+-1.934000
+-1.956000
+-1.820000
+-1.535000
+-1.123000
+-0.618000
+-0.060000
+0.505000
+1.030000
+1.474000
+1.800000
+1.982000
+2.008000
+1.876000
+1.594000
+1.185000
+0.682000
+0.125000
+-0.441000
+-0.968000
+-1.414000
+-1.743000
+-1.929000
+-1.959000
+-1.830000
+-1.552000
+-1.147000
+-0.645000
+-0.089000
+0.477000
+1.006000
+1.454000
+1.786000
+1.977000
+2.011000
+1.886000
+1.611000
+1.208000
+0.709000
+0.153000
+-0.413000
+-0.943000
+-1.394000
+-1.729000
+-1.923000
+-1.961000
+-1.840000
+-1.569000
+-1.169000
+-0.672000
+-0.117000
+0.449000
+0.981000
+1.434000
+1.773000
+1.971000
+2.013000
+1.896000
+1.628000
+1.231000
+0.735000
+0.182000
+-0.385000
+-0.918000
+-1.374000
+-1.716000
+-1.917000
+-1.963000
+-1.850000
+-1.586000
+-1.192000
+-0.699000
+-0.146000
+0.421000
+0.956000
+1.414000
+1.759000
+1.965000
+2.015000
+1.905000
+1.645000
+1.253000
+0.762000
+0.210000
+-0.357000
+-0.893000
+-1.353000
+-1.702000
+-1.911000
+-1.965000
+-1.859000
+-1.603000
+-1.214000
+-0.725000
+-0.174000
+0.393000
+0.930000
+1.393000
+1.745000
+1.958000
+2.016000
+1.915000
+1.661000
+1.276000
+0.788000
+0.238000
+-0.329000
+-0.868000
+-1.333000
+-1.687000
+-1.904000
+-1.966000
+-1.868000
+-1.619000
+-1.237000
+-0.751000
+-0.202000
+0.365000
+0.905000
+1.373000
+1.731000
+1.951000
+2.017000
+1.923000
+1.677000
+1.298000
+0.815000
+0.267000
+-0.301000
+-0.842000
+-1.312000
+-1.673000
+-1.897000
+-1.967000
+-1.877000
+-1.635000
+-1.258000
+-0.777000
+-0.231000
+0.337000
+0.879000
+1.352000
+1.716000
+1.944000
+2.018000
+1.932000
+1.693000
+1.319000
+0.841000
+0.295000
+-0.273000
+-0.816000
+-1.291000
+-1.658000
+-1.889000
+-1.967000
+-1.885000
+-1.650000
+-1.280000
+-0.803000
+-0.259000
+0.309000
+0.854000
+1.330000
+1.701000
+1.936000
+2.018000
+1.940000
+1.708000
+1.341000
+0.866000
+0.323000
+-0.245000
+-0.790000
+-1.269000
+-1.643000
+-1.881000
+-1.967000
+-1.893000
+-1.665000
+-1.301000
+-0.829000
+-0.287000
+0.281000
+0.828000
+1.309000
+1.685000
+1.928000
+2.017000
+1.947000
+1.723000
+1.362000
+0.892000
+0.351000
+-0.217000
+-0.764000
+-1.247000
+-1.627000
+-1.873000
+-1.966000
+-1.901000
+-1.680000
+-1.322000
+-0.855000
+-0.315000
+0.252000
+0.801000
+1.287000
+1.669000
+1.919000
+2.017000
+1.955000
+1.738000
+1.383000
+0.918000
+0.379000
+-0.188000
+-0.738000
+-1.226000
+-1.611000
+-1.864000
+-1.965000
+-1.908000
+-1.695000
+-1.343000
+-0.880000
+-0.343000
+0.224000
+0.775000
+1.265000
+1.653000
+1.910000
+2.016000
+1.962000
+1.752000
+1.404000
+0.943000
+0.407000
+-0.160000
+-0.712000
+-1.203000
+-1.595000
+-1.855000
+-1.964000
+-1.914000
+-1.709000
+-1.364000
+-0.906000
+-0.371000
+0.196000
+0.749000
+1.242000
+1.637000
+1.901000
+2.014000
+1.968000
+1.766000
+1.424000
+0.968000
+0.435000
+-0.132000
+-0.685000
+-1.181000
+-1.578000
+-1.845000
+-1.962000
+-1.921000
+-1.723000
+-1.384000
+-0.931000
+-0.399000
+0.167000
+0.722000
+1.220000
+1.620000
+1.891000
+2.012000
+1.974000
+1.780000
+1.444000
+0.993000
+0.463000
+-0.103000
+-0.659000
+-1.158000
+-1.561000
+-1.835000
+-1.960000
+-1.926000
+-1.736000
+-1.404000
+-0.955000
+-0.427000
+0.139000
+0.695000
+1.197000
+1.603000
+1.881000
+2.010000
+1.980000
+1.793000
+1.464000
+1.018000
+0.491000
+-0.075000
+-0.632000
+-1.135000
+-1.544000
+-1.825000
+-1.958000
+-1.932000
+-1.749000
+-1.423000
+-0.980000
+-0.455000
+0.110000
+0.668000
+1.174000
+1.585000
+1.870000
+2.007000
+1.985000
+1.806000
+1.483000
+1.042000
+0.518000
+-0.046000
+-0.605000
+-1.112000
+-1.526000
+-1.814000
+-1.955000
+-1.937000
+-1.762000
+-1.443000
+-1.005000
+-0.482000
+0.082000
+0.641000
+1.150000
+1.567000
+1.859000
+2.004000
+1.990000
+1.818000
+1.503000
+1.067000
+0.546000
+-0.018000
+-0.578000
+-1.088000
+-1.508000
+-1.803000
+-1.952000
+-1.942000
+-1.774000
+-1.462000
+-1.029000
+-0.510000
+0.053000
+0.614000
+1.127000
+1.549000
+1.848000
+2.000000
+1.994000
+1.831000
+1.521000
+1.091000
+0.573000
+0.011000
+-0.551000
+-1.065000
+-1.490000
+-1.792000
+-1.948000
+-1.946000
+-1.786000
+-1.480000
+-1.053000
+-0.537000
+0.025000
diff --git a/macros/wind.sci b/macros/wind.sci
new file mode 100644
index 0000000..9e1708f
--- /dev/null
+++ b/macros/wind.sci
@@ -0,0 +1,50 @@
+function w_out = wind (f, m, varargin)
+//This function creates an m-point window from the function f given as input.
+//Calling Sequence
+//w = window(f, m)
+//w = window(f, m, opts)
+//Parameters
+//f: string value/window name
+//m: positive integer value
+//opts: string value, takes in "periodic" or "symmetric"
+//w: output variable, vector of real numbers
+//Description
+
+//This function creates an m-point window from the function f given as input, in the output vector w.
+//f can take any valid function as a string, for example "blackmanharris".
+//Examples
+//window("hanning",5)
+//ans =
+// 0.
+// 0.5
+// 1.
+// 0.5
+// 0.
+funcprot(0);
+rhs = argn(2)
+lhs = argn(1)
+
+if(type(f)==10) // Checking whether 'f' is string or not
+ if(f=="bartlett" | f=="blackman" | f=="blackmanharris" | f=="bohmanwin" | f=="boxcar" |...
+ f=="barthannwin" | f=="chebwin"| f=="flattopwin" | f=="gausswin" | f=="hamming" |...
+ f=="hanning" | f=="hann" | f=="kaiser" | f=="parzenwin" | f=="triang" |...
+ f=="rectwin" | f=="tukeywin" | f=="blackmannuttall" | f=="nuttallwin")
+ if(rhs<2)
+ error("Wrong number of input arguments.")
+ else
+ c =evstr (f);
+ w=c(m, varargin(:))
+ if (lhs > 0)
+ w_out = w;
+ end
+ end
+
+ else
+ error("Use proper Window name")
+ end
+
+else
+ error("The first argument f that is window name should be a string")
+end
+
+endfunction
diff --git a/macros/window.sci b/macros/window.sci
deleted file mode 100644
index 5bf3982..0000000
--- a/macros/window.sci
+++ /dev/null
@@ -1,35 +0,0 @@
-function [w] = window (f, m, varargin)
-//This function creates an m-point window from the function f given as input.
-//Calling Sequence
-//w = window(f, m)
-//w = window(f, m, opts)
-//Parameters
-//f: string value
-//m: positive integer value
-//opts: string value, takes in "periodic" or "symmetric"
-//w: output variable, vector of real numbers
-//Description
-//This is an Octave function.
-//This function creates an m-point window from the function f given as input, in the output vector w.
-//f can take any valid function as a string, for example "blackmanharris".
-//Examples
-//window("hanning",5)
-//ans =
-// 0.
-// 0.5
-// 1.
-// 0.5
-// 0.
-funcprot(0);
-rhs = argn(2)
-if(rhs<2)
-error("Wrong number of input arguments.")
-end
- select(rhs)
- case 2 then
- [w] = callOctave("window",f,m)
- case 3 then
- [w] = callOctave("window",f,m,varargin(1))
- end
-endfunction
-
diff --git a/test2.sce b/test2.sce
new file mode 100644
index 0000000..0e27f67
--- /dev/null
+++ b/test2.sce
@@ -0,0 +1,605 @@
+//exec ("/home/kartikhegde/Downloads/FOSSEE_Scilab_Octave_Interface_Toolbox/loader.sce")
+exec("loader.sce")
+exec("builder.sce")
+exec("unloader.sce")
+exec("loader.sce")
+
+test_pass=[]
+res=[]
+
+
+/////////Test case for 1)armcov //////////
+
+A = [1 -2.7607 3.8106 -2.6535 0.9238];
+y=fscanfMat("macros/txt1_armcov.txt")
+
+arcoeffs = armcov(y,4);
+arcoeffs =roundn(arcoeffs,4)
+
+if(arcoeffs==[1 -2.745 3.7762 -2.6201 0.9104])
+ test_pass=[test_pass,1]
+else
+ test_pass=[test_pass,0]
+ disp("armcov Test failed")
+end
+
+/////////////////////////////////////////////
+
+
+/////////Test case for 2) buttord //////////
+
+Wp = 40/500;
+Ws = 150/500;
+
+[n, Wn] = buttord(Wp, Ws, 3, 60);
+Wn=roundn(Wn,7)
+
+if(Wn==0.0800376 & n==5)
+ test_pass=[test_pass,1]
+else
+ test_pass=[test_pass,0]
+ disp("buttord Test failed")
+end
+
+//
+///////////////////////////////////////////////
+//
+//
+///////////Test case for 3) cconv //////////
+//
+:
+a=[1 2 3]
+b=[4 5 6]
+
+o=cconv(a,b,3)
+
+if(o==[31 31 28])
+ test_pass=[test_pass,1]
+ else
+ test_pass=[test_pass,0]
+ disp("cconv Test failed")
+end
+//
+//
+//
+///////////////////////////////////////////////
+//
+//
+///////////Test case for 4) cheby2 //////////
+////
+//x=2;
+//y=5;
+//z=0.7;
+//
+//[a,b,c]=cheby2(x,y,z,"high");
+//a=roundn(a,4);
+//b=roundn(b,4);
+//c=roundn(c,4);
+//
+//if(a==[-0.3165-0.9486*%i -0.3165+0.9486*%i] & b==[-0.3939+0.5314*%i -0.3939-0.5314*%i])
+// if(c==0.4753)
+// test_pass=[test_pass,1]
+// else
+// test_pass=[test_pass,0]
+// disp("cheby2 Test failed")
+// end
+//end
+////
+///////////////////////////////////////////////
+//
+//
+/////////Test case for 5) cummax //////////
+
+v = [8 9 1 10 6 1 3 6 10 10];
+
+M = cummax(v)
+
+if(M==[8 9 9 10 10 10 10 10 10 10])
+ test_pass=[test_pass,1]
+ else
+ test_pass=[test_pass,0]
+ disp("cummax Test failed")
+end
+//
+///////////////////////////////////////////////
+//
+//
+///////////Test case for 6) decimate //////////
+//
+//t = 0:.00025:1;
+//x = sin(2*%pi*30*t) + sin(2*%pi*60*t);
+//
+//y = decimate(x,4);
+//y=y'; //converting it to column matrix
+//y=roundn(y,4);
+//M=fscanfMat("macros/txt2_decimate.txt")
+//
+//if(M==y)
+// test_pass=[test_pass,1]
+// else
+// test_pass=[test_pass,0]
+// disp("decimate Test failed")
+//end
+//
+///////////////////////////////////////////////
+//
+//
+///////////Test case for 7) filtfilt //////////
+////
+//b=1;
+//a=2*%i;
+//x=[%i -4 0];
+//
+//y=filtfilt (b,a,x)
+//
+//if(y==[-0.25*%i 1 0])
+// test_pass=[test_pass,1]
+// else
+// test_pass=[test_pass,0]
+// disp("filtfilt Test failed")
+//end
+//
+///////////////////////////////////////////////
+//
+//
+///////////Test case for 8) filtic //////////
+//
+//b=[%i,1,-%i,5];
+//a=[1,2,3*%i];
+//y= [0.8*%i,7,9];
+//
+//zf=filtic(b,a,y)
+//zf=roundn(zf,4)
+//
+//if(zf==[-22.6*%i;2.4;0])
+// test_pass=[test_pass,1]
+// else
+// test_pass=[test_pass,0]
+// disp("filtic Test failed")
+//end
+////
+////
+/////////////////////////////////////////////////
+////
+////
+/////////////Test case for 9)firtype //////////
+//
+b=[9.2762e-05 9.5482e-02 4.0443e-01 4.0443e-01 9.5482e-02 9.2762e-05]
+
+ftype=firtype(b)
+
+if(ftype==2)
+ test_pass=[test_pass,1]
+ else
+ test_pass=[test_pass,0]
+ disp("firtype Test failed")
+end
+////
+/////////////////////////////////////////////////
+////
+////
+/////////////Test case for 10)fwhmjlt //////////
+////
+//t=-50:0.01:50;
+//y=(1/(2*sqrt(2*%pi)))*exp(-(t.^2)/8);
+//
+//z=fwhmjlt(y)
+//z=roundn(z,4)
+//
+//if(z==470.9644)
+// test_pass=[test_pass,1]
+//else
+// test_pass=[test_pass,0]
+// disp("fwhmjlt Test failed")
+//end
+//
+///////////////////////////////////////////////
+//
+//
+//
+///////////Test case for 11)helperHarmonicDisutortionAmplifier ///////
+//
+
+VmaxPk = 2;
+Fi = 2000;
+Fs = 44.1e3;
+Tstop = 50e-3;
+t = 0:1/Fs:Tstop;
+inputVmax = VmaxPk*sin(2*%pi*Fi*t);
+
+outputVmax = helperHarmonicDistortion(inputVmax);
+outputVmax=outputVmax';
+outputVmax=roundn(outputVmax,3);
+M=fscanfMat("macros/txt3_helperHDA.txt")
+
+if(M==outputVmax)
+ test_pass=[test_pass,1]
+else
+ test_pass=[test_pass,0]
+ disp("helperHarmonicDistortionAmplifier Test failed")
+end
+//
+///////////////////////////////////////////////
+//
+//
+//
+///////////Test case for 12)icceps //////////
+//
+xhat=[ 2.2428 -0.0420 -0.0210 0.0045 0.0366 0.0788 0.1386 0.2327 0.4114 0.9249]
+
+icc = icceps(xhat,2);
+icc=round(icc)
+
+if(icc==[2 3 4 5 6 7 8 9 10 1])
+ test_pass=[test_pass,1]
+else
+ test_pass=[test_pass,0]
+ disp("icceps Test failed")
+end
+//
+///////////////////////////////////////////////
+//
+//
+///////////Test case for 13)impz //////////
+//
+//b=[0 1 1];
+//a=[1 -3 3 -1];
+//n=10;
+//
+//[x_r,t_r]=impz(b,a,n)
+//
+//if(t_r==[0 1 2 3 4 5 6 7 8 9] & x_r==[0 1 4 9 16 25 36 49 64 81])
+// test_pass=[test_pass,1]
+//else
+// test_pass=[test_pass,0]
+// disp("impz Test failed")
+//end
+//
+///////////////////////////////////////////////
+//
+//
+///////////Test case for 14)impzlength //////////
+//
+b = 1;
+a = [1 -0.9];
+
+len = impzlength(b,a)
+
+if(len==93)
+ test_pass=[test_pass,1]
+else
+ test_pass=[test_pass,0]
+ disp("impzlength Test failed")
+end
+//
+///////////////////////////////////////////////
+//
+//
+//
+///////////Test case for 15)intfilt //////////
+//
+R=2;
+L=3;
+
+h=intfilt(R,L,'l');
+
+if(h==[-0.0625 0 0.5625 1 0.5625 0 -0.0625])
+ test_pass=[test_pass,1]
+else
+ test_pass=[test_pass,0]
+ disp("intfilt Test failed")
+end
+//
+///////////////////////////////////////////////
+//
+//
+///////////Test case for 16)is2rc //////////
+//
+k = [0.3090 0.9801 0.0031 0.0082 -0.0082];
+isin = rc2is(k)
+
+k_dash = is2rc(isin)
+k_dash = roundn(k_dash,4)
+
+if(k_dash==[0.309 0.9801 0.0031 0.0082 -0.0082])
+ test_pass=[test_pass,1]
+else
+ test_pass=[test_pass,0]
+ disp("is2rc Test failed")
+end
+//
+///////////////////////////////////////////////
+//
+//
+///////////Test case for 17)isallpass //////////
+//
+k = [1/2 1/3 1/4 1/5];
+[b,a] = latc2tf(k,'allpass');
+
+flag_isallpass = isallpass(b,a)
+
+if(flag_isallpass==1)
+ test_pass=[test_pass,1]
+else
+ test_pass=[test_pass,0]
+ disp("isallpass Test failed")
+end
+//
+///////////////////////////////////////////////
+//
+//
+//
+///////////Test case for 12)barthannwin //////////
+//
+win=barthannwin(4)
+win=roundn(win,4)
+
+if(win==[0;0.73;0.73;0])
+ test_pass=[test_pass,1]
+else
+ test_pass=[test_pass,0]
+ disp("barthannwin Test failed")
+end
+//
+//
+//
+///////////Test case for 13)blackmanharris //////////
+//
+win=blackmanharris(4,"symmetric")
+win=roundn(win,3)
+
+if(win==[0;0.521;0.521;0])
+ test_pass=[test_pass,1]
+else
+ test_pass=[test_pass,0]
+ disp("blackmanharris Test failed")
+end
+//
+//
+//
+///////////Test case for 14)blackmannuttall //////////
+//
+win=blackmannuttall(5)
+win=roundn(win,4)
+
+if(win==[0.0004;0.227;1;0.227;0.0004])
+ test_pass=[test_pass,1]
+else
+ test_pass=[test_pass,0]
+ disp("blackmannuttall Test failed")
+end
+//
+//
+//
+///////////Test case for 15)bohmanwin //////////
+//
+win=bohmanwin(5)
+win=roundn(win,4)
+
+if(win==[0;0.3183;1;0.3183;0])
+ test_pass=[test_pass,1]
+else
+ test_pass=[test_pass,0]
+ disp("bohmanwin Test failed")
+end
+//
+//
+//
+///////////Test case for 16)boxcar //////////
+//
+win=boxcar(5)
+
+if(win==[1;1;1;1;1])
+ test_pass=[test_pass,1]
+else
+ test_pass=[test_pass,0]
+ disp("boxcar Test failed")
+end
+//
+//
+//
+///////////Test case for 17)cheb //////////
+//
+chebpoly=cheb(3,0.6)
+z=round(chebpoly*1000)
+
+if(z==-936)
+ test_pass=[test_pass,1]
+else
+ test_pass=[test_pass,0]
+ disp("cheb Test failed")
+end
+//
+//
+//
+///////////Test case for 18)chebwin //////////
+//
+k=(chebwin(7)*100)
+k=roundn(k,4)
+
+if(k==[5.6504 31.6609 76.0121 100 76.0121 31.6609 5.6504]')
+ test_pass=[test_pass,1]
+else
+ test_pass=[test_pass,0]
+ disp("chebwin Test failed")
+end
+//
+//
+//
+///////////Test case for 19)flattopwin //////////
+//
+win=flattopwin(8,"periodic")
+win=roundn(win,4)
+
+if(win==[0.0009 -0.0264 -0.0556 0.4435 1 0.4435 -0.0556 -0.0264]')
+ test_pass=[test_pass,1]
+else
+ test_pass=[test_pass,0]
+ disp("flattopwin Test failed")
+end
+//
+//
+//
+///////////Test case for 20)hamming //////////
+//
+win=hamming(5)
+win=roundn(win,4)
+
+if(win==[0.08 0.54 1 0.54 0.08]')
+ test_pass=[test_pass,1]
+else
+ test_pass=[test_pass,0]
+ disp("hamming Test failed")
+end
+//
+//
+//
+///////////Test case for 21)hanning //////////
+//
+win=hanning(5)
+win=roundn(win,4)
+
+if(win==[0 0.5 1 0.5 0]')
+ test_pass=[test_pass,1]
+else
+ test_pass=[test_pass,0]
+ disp("hanning Test failed")
+end
+//
+//
+//
+///////////Test case for 22)hann //////////
+//
+win=hann(5)
+win=roundn(win,4)
+
+if(win==[0 0.5 1 0.5 0]')
+ test_pass=[test_pass,1]
+else
+ test_pass=[test_pass,0]
+ disp("hann Test failed")
+end
+//
+//
+//
+///////////Test case for 23)nuttallwin //////////
+//
+win=nuttallwin(5)
+win=roundn(win,4)
+
+if(win==[0 0.2115 1 0.2115 0]')
+ test_pass=[test_pass,1]
+else
+ test_pass=[test_pass,0]
+ disp("nuttallwin Test failed")
+end
+//
+//
+//
+///////////Test case for 24)parzenwin //////////
+//
+win=parzenwin(5)
+win=roundn(win,4)
+
+if(win==[0.016 0.424 1 0.424 0.016]')
+ test_pass=[test_pass,1]
+else
+ test_pass=[test_pass,0]
+ disp("parzenwin Test failed")
+end
+//
+//
+//
+///////////Test case for 25)rectwin //////////
+//
+win=rectwin(5)
+
+if(win==[1 1 1 1 1]')
+ test_pass=[test_pass,1]
+else
+ test_pass=[test_pass,0]
+ disp("rectwin Test failed")
+end
+//
+//
+//
+///////////Test case for 26)tukeywin //////////
+//
+win=tukeywin(6)
+win=roundn(win,4)
+
+if(win==[0 0.9045 1 1 1 0.9045 0]')
+ test_pass=[test_pass,1]
+else
+ test_pass=[test_pass,0]
+ disp("tukeywin Test failed")
+end
+//
+//
+//
+///////////Test case for 27)wind //////////
+//
+win=wind("triang",4)
+
+if(win==[0.25 0.75 0.75 0.25]')
+ test_pass=[test_pass,1]
+else
+ test_pass=[test_pass,0]
+ disp("wind Test failed")
+end
+//
+//
+//
+///////////Test case for 28)oct_interp //////////
+//
+intp=oct_interp(1,2);
+intp=roundn(intp,4);
+
+if(intp==[0.4793 0.3626])
+ test_pass=[test_pass,1]
+else
+ test_pass=[test_pass,0]
+ disp("oct_interp Test failed")
+end
+//
+//
+//
+///////////Test case for 29)fir1 //////////
+//
+f1=fir1(2, .5, 'low', "hanning", 'scale');
+
+if(f1==[0 1 0])
+ test_pass=[test_pass,1]
+else
+ test_pass=[test_pass,0]
+ disp("fir1 Test failed")
+end
+//
+//
+//
+///////////Test case for 30)fir2 //////////
+//
+f = [0 0.6 0.6 1]; m = [1 1 0 0];
+b9 = fir2 (30, f, m, 9);
+b16 = fir2 (30, f, m, 16);
+b17 = fir2 (30, f, m, 17);
+b32 = fir2 (30, f, m, 32);
+
+if(b9==b16 & b17==b32 )
+ test_pass=[test_pass,1]
+else
+ test_pass=[test_pass,0]
+ disp("fir2 Test failed")
+end
+//
+//
+//
+res=find(test_pass==0)
+
+if(res~=[])
+ disp("One or more tests failed")
+ exit(1)
+else
+ disp("pass")
+ exit
+end