Commit 624c5ecc authored by Fredrik Bagge Carlson's avatar Fredrik Bagge Carlson
Browse files

Add more methods

parent 55ed98e2
"""`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"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment