summaryrefslogtreecommitdiff
path: root/macros
diff options
context:
space:
mode:
Diffstat (limited to 'macros')
-rw-r--r--macros/ar_psd.sci17
-rw-r--r--macros/arch_test.sci46
-rw-r--r--macros/bilinear.sci27
-rw-r--r--macros/cohere.sci11
-rw-r--r--macros/detrend1.sci11
-rw-r--r--macros/libbin6552 -> 6648 bytes
-rw-r--r--macros/names4
-rwxr-xr-xmacros/periodogram.sci46
8 files changed, 152 insertions, 10 deletions
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");
diff --git a/macros/lib b/macros/lib
index 643f8e5..4ca8135 100644
--- a/macros/lib
+++ b/macros/lib
Binary files differ
diff --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