From ca56221287613ef90e4d69c0efae07d25b9afc71 Mon Sep 17 00:00:00 2001
From: Fredrik Bagge Carlsson <cont-frb@ulund.org>
Date: Tue, 8 Sep 2015 20:51:48 +0200
Subject: [PATCH] TF -> TFdata

---
 REQUIRE                     |  1 +
 src/SystemIdentification.jl |  5 +++--
 src/transfer_functions.jl   | 10 ++++++----
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/REQUIRE b/REQUIRE
index 8debf7d..2d16982 100644
--- a/REQUIRE
+++ b/REQUIRE
@@ -1,2 +1,3 @@
 SCS
 Convex
+DSP
diff --git a/src/SystemIdentification.jl b/src/SystemIdentification.jl
index 655bec8..155553f 100644
--- a/src/SystemIdentification.jl
+++ b/src/SystemIdentification.jl
@@ -4,7 +4,7 @@ export
 Model,LinearModel,NonLinearModel,
 Network,
 Polynom,PolynomMatrix,
-TF,
+TFdata,
 AR,
 ARX,
 RBFARX,
@@ -18,6 +18,7 @@ toeplitz, kalman
 ## Fit Methods =================
 :LS
 :LS_reg
+:L1
 :LM
 
 ## Types =======================
@@ -59,7 +60,7 @@ type ARX <: LinearModel
     nb::Polynom{Int}
 end
 
-type TF <: LinearModel
+type TFdata <: LinearModel
     P
     F
 end
diff --git a/src/transfer_functions.jl b/src/transfer_functions.jl
index d862c4a..eb0814b 100644
--- a/src/transfer_functions.jl
+++ b/src/transfer_functions.jl
@@ -1,17 +1,19 @@
 using DSP
+
 function tfest(y,u)
     Cyu = xcorr(y,u)
     Cuu = xcorr(u,u)
     Syu = welch_pgram(Cyu)
     Suu = welch_pgram(Cuu)
-    return H = TF(Syu.power./Suu.power,Syu.freq)
-
+    return H = TFdata(Syu.power./Suu.power,Syu.freq)
 end
 
+tfest(iddata::IdData) = tfest(iddata.y,iddata.u)
+
 
 N = 200000;
 u = randn(N);
-y = filt(ones(30),30,u);
+y = filt(ones(5),5,u);
 
 H = tfest(y,u);
-loglog(H.f,abs(H.P))
+semilogy(H.F,abs(H.P))
-- 
GitLab