summaryrefslogtreecommitdiff
path: root/R/estUtil.R
diff options
context:
space:
mode:
authorSuraj Yerramilli2016-02-29 16:43:13 +0530
committerSuraj Yerramilli2016-02-29 16:43:13 +0530
commit72529d245c99d5aff638cb820514ce1ce5b7bfe6 (patch)
tree09a584c789bcd474dea9d88f9ae7036d00b73d5b /R/estUtil.R
parent604a04350b735761fe9e7e0338ab7a9937161177 (diff)
downloadSysID-R-code-72529d245c99d5aff638cb820514ce1ce5b7bfe6.tar.gz
SysID-R-code-72529d245c99d5aff638cb820514ce1ce5b7bfe6.tar.bz2
SysID-R-code-72529d245c99d5aff638cb820514ce1ce5b7bfe6.zip
added support for C polynoial to be zero order
Diffstat (limited to 'R/estUtil.R')
-rw-r--r--R/estUtil.R6
1 files changed, 4 insertions, 2 deletions
diff --git a/R/estUtil.R b/R/estUtil.R
index 00404b0..353c100 100644
--- a/R/estUtil.R
+++ b/R/estUtil.R
@@ -197,14 +197,16 @@ bjGrad <- function(theta,e,dots){
reg <- function(i) {
if(nk==0) v <- i-0:(nb-1) else v <- i-nk:nb1
- matrix(c(uout[v,],eout[i-1:nc,],wout[i-1:nd,],-zetaout[i-1:nf,]))
+ ereg <- if(nc==0) NULL else eout[i-1:nc,]
+ matrix(c(uout[v,],ereg,wout[i-1:nd,],-zetaout[i-1:nf,]))
}
X <- t(sapply(n+1:N,reg))
l <- list(X=X,Y=y,e=e)
if(!is.null(e)){
- den <- as.numeric(polynom::polynomial(c(1,theta[nb+1:nc]))*
+ C_params <- if(nc==0) NULL else theta[nb+1:nc]
+ den <- as.numeric(polynom::polynomial(c(1,C_params))*
polynom::polynomial(c(1,theta[nb+nc+nd+1:nf])))
filt1 <- signal::Arma(b=c(1,theta[nb+nc+1:nd]),
a=den)