diff options
author | bgtushar | 2017-11-30 14:54:09 +0530 |
---|---|---|
committer | GitHub | 2017-11-30 14:54:09 +0530 |
commit | 99b498fb0cedd8560d18f032a4cb1fcae0c1fadb (patch) | |
tree | 7dc4d248208dd3ea7dac6e4ffb056f9b16a601eb /macros/arma_rnd.sci | |
parent | 14d0ad8d846d12b3c82b0b5bc4ffd4d1360ec288 (diff) | |
parent | 9d18f39d1775acd7f96e2388b186bb15068ff910 (diff) | |
download | FOSSEE-Signal-Processing-Toolbox-99b498fb0cedd8560d18f032a4cb1fcae0c1fadb.tar.gz FOSSEE-Signal-Processing-Toolbox-99b498fb0cedd8560d18f032a4cb1fcae0c1fadb.tar.bz2 FOSSEE-Signal-Processing-Toolbox-99b498fb0cedd8560d18f032a4cb1fcae0c1fadb.zip |
Merge pull request #8 from Brijeshcr/master
Added new functions
Diffstat (limited to 'macros/arma_rnd.sci')
-rw-r--r-- | macros/arma_rnd.sci | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/macros/arma_rnd.sci b/macros/arma_rnd.sci new file mode 100644 index 0000000..bc826f4 --- /dev/null +++ b/macros/arma_rnd.sci @@ -0,0 +1,52 @@ +function res = arma_rnd (a, b, v, t, n) +//Return a simulation of the ARMA model. +//Calling Sequence +//arma_rnd (a, b, v, t, n) +//arma_rnd (a, b, v, t) +//Parameters +//a: vector +//b: vector +//v: Variance +//t: Length of output vector +//n: Number of dummy x(i) used for initialization +//Description +//This is an Octave function. +//The ARMA model is defined by +// +//x(n) = a(1) * x(n-1) + … + a(k) * x(n-k) +// + e(n) + b(1) * e(n-1) + … + b(l) * e(n-l) +//in which k is the length of vector a, l is the length of vector b and e is Gaussian white noise with variance v. The function returns a vector of length t. +// +//The optional parameter n gives the number of dummy x(i) used for initialization, i.e., a sequence of length t+n is generated and x(n+1:t+n) is returned. If n is omitted, n = 100 is used. +//Examples +//a = [1 2 3 4 5]; +//b = [7; 8; 9; 10; 11]; +//v = 10; +//t = 5; +//n = 100; +//arma_rnd (a, b, v, t, n) +//ans = +// +// -1.6176e+05 +// -4.1663e+05 +// -1.0732e+06 +// -2.7648e+06 +// -7.1221e+06 + +funcprot(0); +lhs = argn(1) +rhs = argn(2) +if (rhs < 5 | rhs > 6) +error("Wrong number of input arguments.") +end + +select(rhs) + + case 5 then + res = callOctave("arma_rnd",a, b, v, t) + + case 6 then + res = callOctave("arma_rnd",a, b, v, t, n) + + end +endfunction |