diff options
21 files changed, 333 insertions, 19 deletions
diff --git a/help/en_US/arch_test.xml b/help/en_US/arch_test.xml new file mode 100644 index 0000000..aa57ff0 --- /dev/null +++ b/help/en_US/arch_test.xml @@ -0,0 +1,73 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + * + * This help file was generated from arch_test.sci using help_from_sci(). + * + --> + +<refentry version="5.0-subset Scilab" xml:id="arch_test" 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>arch_test</refname> + <refpurpose>perform a Lagrange Multiplier (LM) test of thenull hypothesis of no conditional heteroscedascity against the alternative of CH(P)</refpurpose> + </refnamediv> + + +<refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis> + arch_test(Y,X,P) + PVAL = arch_test(Y,X,P) + [PVAL, LM]= arch_test(Y,X,P) + </synopsis> +</refsynopsisdiv> + +<refsection> + <title>Parameters</title> + <variablelist> + <varlistentry><term>P:</term> + <listitem><para> Degrees of freedom</para></listitem></varlistentry> + <varlistentry><term>PVAL:</term> + <listitem><para>PVAL is the p-value (1 minus the CDF of this distribution at LM) of the test</para></listitem></varlistentry> + </variablelist> +</refsection> + +<refsection> + <title>Description</title> + <para> +perform a Lagrange Multiplier (LM) test of thenull hypothesis of no conditional heteroscedascity against the alternative of CH(P). + </para> + <para> +I.e., the model is + </para> + <para> +y(t) = b(1) * x(t,1) + ... + b(k) * x(t,k) + e(t), + </para> + <para> +given Y up to t-1 and X up to t, e(t) is N(0, h(t)) with + </para> + <para> +h(t) = v + a(1) * e(t-1)^2 + ... + a(p) *e(t-p)^2, and the null is a(1) == ... == a(p) == 0. + </para> + <para> +If the second argument is a scalar integer, k,perform the sametest in a linear autoregression model of orderk, i.e., with + </para> + <para> +[1, y(t-1), ..., y(t-K)] as the t-th row of X. + </para> + <para> +Under the null, LM approximatel has a chisquare distribution with P degrees of freedom and PVAL is the p-value (1 minus the CDF of this distribution at LM) of the test. + </para> + <para> +If no output argument is given, the p-value is displayed. +</para> +</refsection> +</refentry> diff --git a/help/en_US/detrend1.xml b/help/en_US/detrend1.xml new file mode 100644 index 0000000..783d922 --- /dev/null +++ b/help/en_US/detrend1.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + * + * This help file was generated from detrend1.sci using help_from_sci(). + * + --> + +<refentry version="5.0-subset Scilab" xml:id="detrend1" 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>detrend1</refname> + <refpurpose>This function removes the best fit of a polynomial of order P from the data X</refpurpose> + </refnamediv> + + +<refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis> + detrend1(X,P) + </synopsis> +</refsynopsisdiv> + +<refsection> + <title>Parameters</title> + <variablelist> + <varlistentry><term>X:</term> + <listitem><para> Input vecor or matrix.</para></listitem></varlistentry> + <varlistentry><term>P:</term> + <listitem><para> The order of polnomial</para></listitem></varlistentry> + </variablelist> +</refsection> + +<refsection> + <title>Description</title> + <para> +If X is a vector, 'detrend1(X, P)' removes the best fit of apolynomial of order P from the data X.If X is a matrix, 'detrend1(X, P)' does the same for each column in X. + </para> + <para> +The second argument P is optional. If it is not specified, a value of 1 is assumed. This corresponds to removing a linear trend. +The order of the polynomial can also be given as a string, in which case P must be either "constant" (corresponds to 'P=0') or "linear"(corresponds to 'P=1') +</para> +</refsection> +</refentry> diff --git a/help/en_US/master_help.xml b/help/en_US/master_help.xml index 29bb0db..402f8b6 100644 --- a/help/en_US/master_help.xml +++ b/help/en_US/master_help.xml @@ -5,6 +5,7 @@ <!ENTITY acc27042e738d175d1131be40ac8443e4 SYSTEM "/home/abhinav/Documents/IITB/Repos/FOSSEE-Signal-Processing-Toolbox/help/en_US/ac2rc.xml"> <!ENTITY a00c7c9f2a0021ff13869dce3b90df38c SYSTEM "/home/abhinav/Documents/IITB/Repos/FOSSEE-Signal-Processing-Toolbox/help/en_US/arParEst.xml"> <!ENTITY a2801dc954ec6ac2e1c314367aab7316b SYSTEM "/home/abhinav/Documents/IITB/Repos/FOSSEE-Signal-Processing-Toolbox/help/en_US/arburg.xml"> +<!ENTITY a1495e32bc54c2e2975785e8e2e4521bd SYSTEM "/home/abhinav/Documents/IITB/Repos/FOSSEE-Signal-Processing-Toolbox/help/en_US/arch_test.xml"> <!ENTITY aa86636858e7127f17b93747fc8f3ec30 SYSTEM "/home/abhinav/Documents/IITB/Repos/FOSSEE-Signal-Processing-Toolbox/help/en_US/arcov.xml"> <!ENTITY a2804cc9a113729444d60d8cf3c14b554 SYSTEM "/home/abhinav/Documents/IITB/Repos/FOSSEE-Signal-Processing-Toolbox/help/en_US/armcov.xml"> <!ENTITY a78af20f681c48f8ec298b379b34418b7 SYSTEM "/home/abhinav/Documents/IITB/Repos/FOSSEE-Signal-Processing-Toolbox/help/en_US/aryule.xml"> @@ -47,6 +48,7 @@ <!ENTITY a012dc78292d46d1a6bfdd411607796ae SYSTEM "/home/abhinav/Documents/IITB/Repos/FOSSEE-Signal-Processing-Toolbox/help/en_US/db2pow.xml"> <!ENTITY a4c9381ac38659e2e9ccdf89e9aec08f9 SYSTEM "/home/abhinav/Documents/IITB/Repos/FOSSEE-Signal-Processing-Toolbox/help/en_US/dctmtx.xml"> <!ENTITY a732f6e560fa62dcfe2137f94ce0b812b SYSTEM "/home/abhinav/Documents/IITB/Repos/FOSSEE-Signal-Processing-Toolbox/help/en_US/decimate.xml"> +<!ENTITY aead61bf67b6895372794be69a80b5ab9 SYSTEM "/home/abhinav/Documents/IITB/Repos/FOSSEE-Signal-Processing-Toolbox/help/en_US/detrend1.xml"> <!ENTITY a8e9030fad0ea16388695b20a07e04334 SYSTEM "/home/abhinav/Documents/IITB/Repos/FOSSEE-Signal-Processing-Toolbox/help/en_US/dftmtx.xml"> <!ENTITY a3ffbb42a185eaf6b62029b6efc883d6b SYSTEM "/home/abhinav/Documents/IITB/Repos/FOSSEE-Signal-Processing-Toolbox/help/en_US/diric.xml"> <!ENTITY ac93a3534190eae2db767de3935ad4fbc SYSTEM "/home/abhinav/Documents/IITB/Repos/FOSSEE-Signal-Processing-Toolbox/help/en_US/downsample.xml"> @@ -259,6 +261,7 @@ &acc27042e738d175d1131be40ac8443e4; &a00c7c9f2a0021ff13869dce3b90df38c; &a2801dc954ec6ac2e1c314367aab7316b; +&a1495e32bc54c2e2975785e8e2e4521bd; &aa86636858e7127f17b93747fc8f3ec30; &a2804cc9a113729444d60d8cf3c14b554; &a78af20f681c48f8ec298b379b34418b7; @@ -301,6 +304,7 @@ &a012dc78292d46d1a6bfdd411607796ae; &a4c9381ac38659e2e9ccdf89e9aec08f9; &a732f6e560fa62dcfe2137f94ce0b812b; +&aead61bf67b6895372794be69a80b5ab9; &a8e9030fad0ea16388695b20a07e04334; &a3ffbb42a185eaf6b62029b6efc883d6b; &ac93a3534190eae2db767de3935ad4fbc; diff --git a/help/en_US/periodogram.xml b/help/en_US/periodogram.xml index 8b5b2ed..5ad8738 100644 --- a/help/en_US/periodogram.xml +++ b/help/en_US/periodogram.xml @@ -17,7 +17,47 @@ <refnamediv> <refname>periodogram</refname> - <refpurpose>funcprot(0);</refpurpose> + <refpurpose>Return the periodogram (Power Spectral Density) of X</refpurpose> </refnamediv> + +<refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis> + [PXX, W] = periodogram (X) + [PXX, W] = periodogram (X, WIN) + [PXX, W] = periodogram (X, WIN, NFFT) + [PXX, W] = periodogram (X, WIN, NFFT, FS) + [PXX, W] = periodogram (..., "RANGE") + </synopsis> +</refsynopsisdiv> + +<refsection> + <title>Parameters</title> + <variablelist> + <varlistentry><term>X:</term> + <listitem><para>data vector. If X is real-valued a one-sided spectrum is estimated. If X is complex-valued, or "RANGE" specifies "twosided", the full spectrum is estimated.</para></listitem></varlistentry> + <varlistentry><term>WIN:</term> + <listitem><para> window weight data. If window is empty or unspecified a default rectangular window is used. Otherwise, the window is applied to the signal ('X .* WIN') before computing th periodogram. The window data must be a vector of the same length as X.</para></listitem></varlistentry> + <varlistentry><term>NFFT:</term> + <listitem><para>number of frequency bins. The default is 256 or the next higher power of 2 greater than the length of X ('max (256,2.^nextpow2 (length (x)))'). If NFFT is greater than the length of the input then X will be zero-padded to the length of NFFT.</para></listitem></varlistentry> + <varlistentry><term>FS:</term> + <listitem><para>sampling rate. The default is 1.</para></listitem></varlistentry> + <varlistentry><term>RANGE:</term> + <listitem><para>range of spectrum. "onesided" computes spectrum from [0..nfft/2+1]."twosided" computes spectrum from [0..nfft-1].</para></listitem></varlistentry> + </variablelist> +</refsection> + +<refsection> + <title>Description</title> + <para> +The optional second output W are the normalized angular frequencies. For a one-sided calculation W is in the range [0, pi]. If NFFT is even and [0, pi) if NFFT is odd. Similarly, for a two-sided calculation W is in the range [0, 2*pi] or [0, 2*pi)depending on NFFT. + </para> + <para> +If a sampling frequency is specified, FS, then the output frequencies F will be in the range [0, FS/2] or [0, FS/2) for one-sided calculations. For two-sided calculations the range will be [0, FS). + </para> + <para> +When called with no outputs the periodogram is immediately plotted in the current figure window. +</para> +</refsection> </refentry> diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS b/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS Binary files differindex 3105019..2e55114 100644 --- a/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS +++ b/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS.TAB b/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS.TAB Binary files differindex 16c3c1b..ac87aca 100644 --- a/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS.TAB +++ b/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS.TAB diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/OFFSETS b/help/en_US/scilab_en_US_help/JavaHelpSearch/OFFSETS index 0fd7aff..ae19610 100644 --- a/help/en_US/scilab_en_US_help/JavaHelpSearch/OFFSETS +++ b/help/en_US/scilab_en_US_help/JavaHelpSearch/OFFSETS @@ -1,7 +1,7 @@ -j!(hC(p,AlZs挭t9rGA&ݔxXHʌTM<52TJQ;0@VCE(CF=#3o3Qg0S[c;b1Ye(ƲchVeGE1PQ#'e[rj;VMH'!ni3 -%+
Q欙}wUٗ8܅ Ԙ -MgǏ6H͕*T5&1e2TvKS*e`U;bnVD**|! -#BуyV)`wΘÖuy2yWl4KréPywF-E*E
ZbMlAr{T?˝:z(FȊ24`HR9"m%P,RtRIG)W1K -4I9Ch̩>Vd-5ޱ|31
F8^X
4Coٿx$3c{w~qDEk]Si KGon}Rh84R;Y;+*bYkS}K_lN(~lR~oB<;tioUCpKdkOHBĜ{!W
_g'ZdHf+[%Vjv/e>Yի8]}i'pV>+3a -ݷNFe[6YKIJ1-5 -o#[I. PTH9`k<I7l=C1ʵ]f
\ No newline at end of file +j!(hC
+[>֜u/\=Jp!eI4e9^8)R2-O
LeDq$#Ih,PQi(Hь,4eL3rء{*Vw#J1Ś9G5oF,QGQhci2T1b3dk[rj;VMH'!ni3 +T,9F˚eWj`c$Q`I6}T%tV0ԘKMd_˕SدYLIїu<9/[TRUM?#|T]k(HK=F
Z +83^,E/>bdVDa72_v &/K~MC~xMd㨨=5i3÷ɱ9SxNr.u*"Ե"*lс# Kq^4:22ٴaCIJW'˝ +c|R1qQ{☜ +4I9Ch̩>Vd-5ޱ|32]F_U
66)9JWwnt}Ͽ`GfLw̯IeX7,ҚL#+翘*ұʷ*$f<'?4;^ZWnh7!mZ&45,XV"KI{G7mDj^mQGq +ߋUZ; zn{uk,TXrNo6j"KֳA1-7u5y+p\EI3.RH94R}A$.w_K
\ No newline at end of file diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/POSITIONS b/help/en_US/scilab_en_US_help/JavaHelpSearch/POSITIONS Binary files differindex 5d4fac0..4544947 100644 --- a/help/en_US/scilab_en_US_help/JavaHelpSearch/POSITIONS +++ b/help/en_US/scilab_en_US_help/JavaHelpSearch/POSITIONS diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/SCHEMA b/help/en_US/scilab_en_US_help/JavaHelpSearch/SCHEMA index e6c083a..7d65376 100644 --- a/help/en_US/scilab_en_US_help/JavaHelpSearch/SCHEMA +++ b/help/en_US/scilab_en_US_help/JavaHelpSearch/SCHEMA @@ -1,2 +1,2 @@ JavaSearch 1.0 -TMAP bs=2048 rt=1 fl=-1 id1=2335 id2=1 +TMAP bs=2048 rt=1 fl=-1 id1=2382 id2=1 diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/TMAP b/help/en_US/scilab_en_US_help/JavaHelpSearch/TMAP Binary files differindex ea3dfe8..6337674 100644 --- a/help/en_US/scilab_en_US_help/JavaHelpSearch/TMAP +++ b/help/en_US/scilab_en_US_help/JavaHelpSearch/TMAP diff --git a/help/en_US/scilab_en_US_help/jhelpmap.jhm b/help/en_US/scilab_en_US_help/jhelpmap.jhm index ac7ff93..4e2930e 100644 --- a/help/en_US/scilab_en_US_help/jhelpmap.jhm +++ b/help/en_US/scilab_en_US_help/jhelpmap.jhm @@ -7,6 +7,7 @@ <mapID target="ac2rc" url="ac2rc.html"/> <mapID target="arParEst" url="arParEst.html"/> <mapID target="arburg" url="arburg.html"/> +<mapID target="arch_test" url="arch_test.html"/> <mapID target="arcov" url="arcov.html"/> <mapID target="armcov" url="armcov.html"/> <mapID target="aryule" url="aryule.html"/> @@ -49,6 +50,7 @@ <mapID target="db2pow" url="db2pow.html"/> <mapID target="dctmtx" url="dctmtx.html"/> <mapID target="decimate" url="decimate.html"/> +<mapID target="detrend1" url="detrend1.html"/> <mapID target="dftmtx" url="dftmtx.html"/> <mapID target="diric" url="diric.html"/> <mapID target="downsample" url="downsample.html"/> diff --git a/help/en_US/scilab_en_US_help/jhelptoc.xml b/help/en_US/scilab_en_US_help/jhelptoc.xml index dda12cb..1b4fbc8 100644 --- a/help/en_US/scilab_en_US_help/jhelptoc.xml +++ b/help/en_US/scilab_en_US_help/jhelptoc.xml @@ -7,6 +7,7 @@ <tocitem target="ac2rc" text="ac2rc"/> <tocitem target="arParEst" text="arParEst"/> <tocitem target="arburg" text="arburg"/> +<tocitem target="arch_test" text="arch_test"/> <tocitem target="arcov" text="arcov"/> <tocitem target="armcov" text="armcov"/> <tocitem target="aryule" text="aryule"/> @@ -49,6 +50,7 @@ <tocitem target="db2pow" text="db2pow"/> <tocitem target="dctmtx" text="dctmtx"/> <tocitem target="decimate" text="decimate"/> +<tocitem target="detrend1" text="detrend1"/> <tocitem target="dftmtx" text="dftmtx"/> <tocitem target="diric" text="diric"/> <tocitem target="downsample" text="downsample"/> diff --git a/jar/scilab_en_US_help.jar b/jar/scilab_en_US_help.jar Binary files differindex fe7030d..f54e2b5 100644 --- a/jar/scilab_en_US_help.jar +++ b/jar/scilab_en_US_help.jar diff --git a/macros/ar_psd.sci b/macros/ar_psd.sci new file mode 100644 index 0000000..d60e3c4 --- /dev/null +++ b/macros/ar_psd.sci @@ -0,0 +1,17 @@ +function [P, F]= ar_psd(A, varargin) + funcprot(0); + rhs= argn(2); + if(rhs <2 | rhs>5) + error("Wrong number of input arguments"); + end + select(rhs) + case 2 then + [P,F]= callOctave("ar_psd", A, varargin(1)); + case 3 then + [P,F]= callOctave("ar_psd", A, varargin(1), varargin(2)); + case 4 then + [P,F]= callOctave("ar_psd", A, varargin(1), varargin(2), varargin(3)); + case 5 then + [P,F]= callOctave("ar_psd", A, varargin(1), varargin(2), varargin(3), varargin(4)); + end +endfunction diff --git a/macros/arch_test.sci b/macros/arch_test.sci new file mode 100644 index 0000000..3c53fc5 --- /dev/null +++ b/macros/arch_test.sci @@ -0,0 +1,46 @@ +function [PVAL, LM]= arch_test(Y,X,P) +// perform a Lagrange Multiplier (LM) test of thenull hypothesis of no conditional heteroscedascity against the alternative of CH(P) +//Calling Sequence +//arch_test(Y,X,P) +//PVAL = arch_test(Y,X,P) +//[PVAL, LM]= arch_test(Y,X,P) +//Parameters +//P: Degrees of freedom +//PVAL:PVAL is the p-value (1 minus the CDF of this distribution at LM) of the test +//Description +//perform a Lagrange Multiplier (LM) test of thenull hypothesis of no conditional heteroscedascity against the alternative of CH(P). +// +//I.e., the model is +// +// y(t) = b(1) * x(t,1) + ... + b(k) * x(t,k) + e(t), +// +//given Y up to t-1 and X up to t, e(t) is N(0, h(t)) with +// +// h(t) = v + a(1) * e(t-1)^2 + ... + a(p) *e(t-p)^2, and the null is a(1) == ... == a(p) == 0. +// +//If the second argument is a scalar integer, k,perform the sametest in a linear autoregression model of orderk, i.e., with +// +// [1, y(t-1), ..., y(t-K)] as the t-th row of X. +// +// Under the null, LM approximatel has a chisquare distribution with P degrees of freedom and PVAL is the p-value (1 minus the CDF of this distribution at LM) of the test. +// +// If no output argument is given, the p-value is displayed. + funcprot(0) + rhs= argn(2); + lhs= argn(1); + if(rhs<3 | rhs>3) + error("Wrong number of input arguments"); + end + if(lhs<1 | lhs>2) + error("Wrong number of output arguments"); + end + select(rhs) + case 3 then + select(lhs) + case 1 then + PVAL= callOctave("arch_test", Y, X, P); + case 2 then + [PVAL,LM]= callOctave("arch_test", Y, X, P); + end + end +endfunction
\ No newline at end of file diff --git a/macros/bilinear.sci b/macros/bilinear.sci new file mode 100644 index 0000000..d58dd2a --- /dev/null +++ b/macros/bilinear.sci @@ -0,0 +1,27 @@ +function [Zb, Za, Zg]= bilinear(Sb,varargin) + funcprot(0); + lhs= argn(1); + rhs= argn(2); + if(rhs < 3 | rhs > 4) + error("Wrong number of input arguments"); + end + if(lhs < 2 | lhs > 3) + error("Wrong number of output arguments"); + end + select(rhs) + case 3 then + select(lhs) + case 2 then + [Zb, Za]= callOctave("bilinear", Sb, varargin(1), varargin(2)); + case 3 then + [Zb, Za, Zg]= callOctave("bilinear", Sb, varargin(1), varargin(2)); + end + case 4 then + select(lhs) + case 2 then + [Zb, Za]= callOctave("bilinear", Sb, varargin(1), varargin(2), varargin(3)); + case 3 then + [Zb, Za, Zg]= callOctave("bilinear", Sb, varargin(1), varargin(2), varargin(3)); + end + end +endfunction
\ No newline at end of file diff --git a/macros/cohere.sci b/macros/cohere.sci new file mode 100644 index 0000000..ad964a3 --- /dev/null +++ b/macros/cohere.sci @@ -0,0 +1,11 @@ +function [Pxx,freqs] = cohere(x,y,Nfft,Fs,win,overlap,ran,plot_type,detrends) + rhs= argn(2); + lhs= argn(1); + if(rhs < 10 | rhs > 10) + error("Wrong number of input arguments"); + end + select(rhs) + case 10 then + [Pxx,freqs] = callOctave("cohere",x,y,Nfft,Fs,win,overlap,ran,plot_type,detrends); + end +endfunction
\ No newline at end of file diff --git a/macros/detrend1.sci b/macros/detrend1.sci index b9929f4..52ac26f 100644 --- a/macros/detrend1.sci +++ b/macros/detrend1.sci @@ -1,4 +1,15 @@ function y = detrend1(x, varargin) +//This function removes the best fit of a polynomial of order P from the data X +//Calling Sequence +//detrend1(X,P) +//Parameters +//X: Input vecor or matrix. +//P: The order of polnomial +//Description +//If X is a vector, 'detrend1(X, P)' removes the best fit of apolynomial of order P from the data X.If X is a matrix, 'detrend1(X, P)' does the same for each column in X. +// +//The second argument P is optional. If it is not specified, a value of 1 is assumed. This corresponds to removing a linear trend. +//The order of the polynomial can also be given as a string, in which case P must be either "constant" (corresponds to 'P=0') or "linear"(corresponds to 'P=1') rhs= argn(2); if(rhs<1 | rhs> 2) error("Wrong number of input arguments"); Binary files differdiff --git a/macros/names b/macros/names index af57307..b437c07 100644 --- a/macros/names +++ b/macros/names @@ -1,7 +1,9 @@ ac2poly ac2rc arParEst +ar_psd arburg +arch_test arcov armcov aryule @@ -10,6 +12,7 @@ barthannwin bartlett besselap besself +bilinear bitrevorder blackman blackmanharris @@ -35,6 +38,7 @@ check chirp clustersegment cmorwavf +cohere convmtx corrmtx cplxreal diff --git a/macros/periodogram.sci b/macros/periodogram.sci index 33e15af..ca8995e 100755 --- a/macros/periodogram.sci +++ b/macros/periodogram.sci @@ -1,20 +1,46 @@ function [d,n]=periodogram(a,b,c,d,e) +//Return the periodogram (Power Spectral Density) of X +//Calling Sequence +// [PXX, W] = periodogram (X) +// [PXX, W] = periodogram (X, WIN) +// [PXX, W] = periodogram (X, WIN, NFFT) +// [PXX, W] = periodogram (X, WIN, NFFT, FS) +// [PXX, W] = periodogram (..., "RANGE") +//Parameters +// X:data vector. If X is real-valued a one-sided spectrum is estimated. If X is complex-valued, or "RANGE" specifies "twosided", the full spectrum is estimated. +//WIN: window weight data. If window is empty or unspecified a default rectangular window is used. Otherwise, the window is applied to the signal ('X .* WIN') before computing th periodogram. The window data must be a vector of the same length as X. +//NFFT:number of frequency bins. The default is 256 or the next higher power of 2 greater than the length of X ('max (256,2.^nextpow2 (length (x)))'). If NFFT is greater than the length of the input then X will be zero-padded to the length of NFFT. +//FS:sampling rate. The default is 1. +//RANGE:range of spectrum. "onesided" computes spectrum from [0..nfft/2+1]."twosided" computes spectrum from [0..nfft-1]. +//Description +//The optional second output W are the normalized angular frequencies. For a one-sided calculation W is in the range [0, pi]. If NFFT is even and [0, pi) if NFFT is odd. Similarly, for a two-sided calculation W is in the range [0, 2*pi] or [0, 2*pi)depending on NFFT. +// +//If a sampling frequency is specified, FS, then the output frequencies F will be in the range [0, FS/2] or [0, FS/2) for one-sided calculations. For two-sided calculations the range will be [0, FS). +// +//When called with no outputs the periodogram is immediately plotted in the current figure window. funcprot(0); - [nargout,nargin]=argn(); - select nargin + lhs= argn(1); + rhs= argn(2); + if(rhs<1 | rhs>5) + error("Wrong number of input arguments"); + end + if(lhs>2 | lhs< 2) + error("Wrong number of output arguments"); + end + select(rhs) case 1 then - [d,n]=callOctave('periodogram',a); + [d,n]= callOctave('periodogram',a); case 2 then - [d,n]=callOctave('periodogram',a,b); + [d,n]= callOctave('periodogram',a,b); + case 3 then - [d,n]=callOctave('periodogram',a,b,c); + [d,n]= callOctave('periodogram',a,b,c); + case 4 then - [d,n]=callOctave('periodogram',a,b,c,d); + [d,n]= callOctave('periodogram',a,b,c,d); + case 5 then - [d,n]=callOctave('periodogram',a,b,c,d,e); - else - error("Incorrect no. of Input Arguments"); + [d,n]= callOctave('periodogram',a,b,c,d,e); end - endfunction |