diff options
author | ttt | 2018-07-09 16:54:44 +0530 |
---|---|---|
committer | ttt | 2018-07-09 16:54:44 +0530 |
commit | e5e316e1958e27696d7670e2492992d34ff38b68 (patch) | |
tree | 8dab5cc24e31921cfb3c44444d48cfbfd3ff76f8 /armaX.sci | |
parent | 681c88404f9f2861d228d0d0c3bd61b200ca1442 (diff) | |
download | FOSSEE-System-Identification-Toolbox-e5e316e1958e27696d7670e2492992d34ff38b68.tar.gz FOSSEE-System-Identification-Toolbox-e5e316e1958e27696d7670e2492992d34ff38b68.tar.bz2 FOSSEE-System-Identification-Toolbox-e5e316e1958e27696d7670e2492992d34ff38b68.zip |
added scilabs files
Diffstat (limited to 'armaX.sci')
-rw-r--r-- | armaX.sci | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/armaX.sci b/armaX.sci new file mode 100644 index 0000000..93376e2 --- /dev/null +++ b/armaX.sci @@ -0,0 +1,51 @@ + +function sys = armaX(varargin) + [lhs , rhs] = argn(); + if ( rhs < 2 ) then + errmsg = msprintf(gettext("%s: Unexpected number of input arguments : %d provided while should be 2"), "armaX", rhs); + error(errmsg) + end + + z = varargin(1) + if typeof(z) == 'iddata' then + Ts = z.Ts;unit = z.TimeUnit + z = [z.OutputData z.InputData] + elseif typeof(z) == 'constant' then + Ts = 1;unit = 'seconds' + end + if ((~size(z,2)==2) & (~size(z,1)==2)) then + errmsg = msprintf(gettext("%s: input and output data matrix should be of size (number of data)*2"), "armaX"); + error(errmsg); + end + + if (~isreal(z)) then + errmsg = msprintf(gettext("%s: input and output data matrix should be a real matrix"), "armaX"); + error(errmsg); + end + + n = varargin(2) + if (size(n,"*")<3| size(n,"*")>4) then + errmsg = msprintf(gettext("%s: The order and delay matrix [na nb nc nk] should be of size [3 or 4]"), "armaX"); + error(errmsg); + end + + if (size(find(n<0),"*") | size(find(((n-floor(n))<%eps)== %f))) then + errmsg = msprintf(gettext("%s: values of order and delay matrix [na nb nc nk] should be nonnegative integer number "), "armaX"); + error(errmsg); + end + + na = n(1); nb = n(2); nc = n(3); //nd = n(4);nf = n(5); + + if (size(n,"*") == 3) then + nk = 1 + else + nk = n(4); + end + + // storing U(k) , y(k) and n data in UDATA,YDATA and NDATA respectively + YDATA = z(:,1); + UDATA = z(:,2); + + sys = estpoly(z,[na,nb,nc,0,0,nk]) + +endfunction |