diff --git a/src/armax.jl b/src/armax.jl index 8e42534b492920c1015fdba3405294afe4c8ab72..a9dbf119496ea4d48cefcde809e7ac0d1487e4c3 100644 --- a/src/armax.jl +++ b/src/armax.jl @@ -1,4 +1,4 @@ -"""`ar(y, na; λ = 0, doplot=false)`""" +"""`ar(y, na; λ = 0, doplot=false, bias=false)`""" function ar(y, na; λ = 0, doplot=false, bias=false) y_train, A = getARRegressor(y,na;bias=bias) n_points = size(A,1) @@ -18,7 +18,9 @@ function ar(y, na; λ = 0, doplot=false, bias=false) end return w, error end +ar(iddata, na; λ = 0, doplot=false, bias=false) = ar(iddata.y, na; λ = 0, doplot=doplot, bias=bias) +"""arx(y, u, na, nb; λ = 0, doplot=false, bias=false)""" function arx(y, u, na, nb; λ = 0, doplot=false, bias=false) y_train, A = getARXRegressor(y,u, na, nb; bias=bias) n_points = size(A,1) @@ -38,6 +40,8 @@ function arx(y, u, na, nb; λ = 0, doplot=false, bias=false) end return w, error end +arx(iddata, na, nb; λ = 0, doplot=false, bias=false) = arx(iddata.y, iddata.u, na, nb; λ = 0, doplot=doplot, bias=bias) + function getARRegressor(y,na;bias=false) @@ -50,6 +54,7 @@ function getARRegressor(y,na;bias=false) end return y,A end +getARRegressor(iddata, na, bias=false) = getARXRegressor(iddatay, na, bias=bias) function getARXRegressor(y,u, na, nb; bias=false) assert(length(nb) == size(u,2)) @@ -70,6 +75,7 @@ function getARXRegressor(y,u, na, nb; bias=false) end return y,A end +getARXRegressor(iddata, na, nb; bias=false) = getARXRegressor(iddatay,iddata.u, na, nb, bias=bias) """Plots the RMSE and AIC for model orders up to `n`. Useful for model selection"""