summaryrefslogtreecommitdiff
path: root/R/estpoly.R
diff options
context:
space:
mode:
authorSuraj Yerramilli2015-06-07 19:08:50 +0530
committerSuraj Yerramilli2015-06-07 19:08:50 +0530
commit2f8285c6291e12e7ffa8cd71e9738c7958afecdb (patch)
tree00b3f8d42fa0ba084f3ade570d5e33c2b0cf289f /R/estpoly.R
parenta00eafd068de773660a157794b98b4b99c5de4db (diff)
downloadSysID-R-code-2f8285c6291e12e7ffa8cd71e9738c7958afecdb.tar.gz
SysID-R-code-2f8285c6291e12e7ffa8cd71e9738c7958afecdb.tar.bz2
SysID-R-code-2f8285c6291e12e7ffa8cd71e9738c7958afecdb.zip
Corrected errors and documenting sim.arx
Diffstat (limited to 'R/estpoly.R')
-rw-r--r--R/estpoly.R5
1 files changed, 4 insertions, 1 deletions
diff --git a/R/estpoly.R b/R/estpoly.R
index 7bf94ea..eca1a5f 100644
--- a/R/estpoly.R
+++ b/R/estpoly.R
@@ -99,7 +99,10 @@ estARX <- function(data,order=c(0,1,0)){
yout <- apply(y,2,padZeros,n=n);
uout <- apply(u,2,padZeros,n=n);
- reg <- function(i) cbind(-yout[i-1:na,],uout[i-nk:nb1])
+ reg <- function(i) {
+ if(nk==0) v <- i-0:(nb-1) else v <- i-nk:nb1
+ cbind(-yout[i-1:na,],uout[v])
+ }
X <- t(sapply(n+1:(N+n),reg))
Y <- yout[n+1:(N+n),,drop=F]