From adf6514223430e57e96329aa60ac948802daf2b0 Mon Sep 17 00:00:00 2001
From: Fredrik Bagge Carlsson <cont-frb@ulund.org>
Date: Sat, 5 Sep 2015 14:52:04 +0200
Subject: [PATCH] ar and arx seem to work well now, tests have been updated.

---
 src/SystemIdentification.jl | 7 +++++++
 src/armax.jl                | 1 -
 test/tests.jl               | 1 +
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/SystemIdentification.jl b/src/SystemIdentification.jl
index 0374b49..364e1ed 100644
--- a/src/SystemIdentification.jl
+++ b/src/SystemIdentification.jl
@@ -37,6 +37,13 @@ type AR <: LinearModel
     a::Polynom
     na::Int
 end
+function Base.show(m::AR)
+    print("A(z) = 1")
+    for i = 1:length(m.a)
+        print(m.a[i], " + z^-$i")
+    end
+    print("\n")
+end
 
 """
 `a::Vector{Float64}`: The polynomial coeffs A(z) (not including the first 1)\n
diff --git a/src/armax.jl b/src/armax.jl
index 36477a7..a5f921c 100644
--- a/src/armax.jl
+++ b/src/armax.jl
@@ -27,7 +27,6 @@ function arx(y::Vector{Float64}, u::VecOrMat{Float64}, na, nb; λ = 0, doplot=fa
     prediction = A*w
     error = y_train - prediction
 
-
     si = na+1
     b = Polynom[w[si:si+nb[1]-1]]
     si += nb[1]
diff --git a/test/tests.jl b/test/tests.jl
index 323ed66..addb00c 100644
--- a/test/tests.jl
+++ b/test/tests.jl
@@ -83,6 +83,7 @@ function run_tests()
         model, result = arx(collect(1:5.0),collect(1:5.0),1,1,λ = 1)
         @tassert result.method == :LS_reg
         @tassert result.λ == 1
+        model, result = arx(collect(1:5.0),[collect(2:6.0) ones(5)],2,[2,1])
     end
 end
 
-- 
GitLab