Commit ca562212 authored by Fredrik Bagge Carlson's avatar Fredrik Bagge Carlson
Browse files

TF -> TFdata

parent a490a644
SCS SCS
Convex Convex
DSP
...@@ -4,7 +4,7 @@ export ...@@ -4,7 +4,7 @@ export
Model,LinearModel,NonLinearModel, Model,LinearModel,NonLinearModel,
Network, Network,
Polynom,PolynomMatrix, Polynom,PolynomMatrix,
TF, TFdata,
AR, AR,
ARX, ARX,
RBFARX, RBFARX,
...@@ -18,6 +18,7 @@ toeplitz, kalman ...@@ -18,6 +18,7 @@ toeplitz, kalman
## Fit Methods ================= ## Fit Methods =================
:LS :LS
:LS_reg :LS_reg
:L1
:LM :LM
## Types ======================= ## Types =======================
...@@ -59,7 +60,7 @@ type ARX <: LinearModel ...@@ -59,7 +60,7 @@ type ARX <: LinearModel
nb::Polynom{Int} nb::Polynom{Int}
end end
type TF <: LinearModel type TFdata <: LinearModel
P P
F F
end end
......
using DSP using DSP
function tfest(y,u) function tfest(y,u)
Cyu = xcorr(y,u) Cyu = xcorr(y,u)
Cuu = xcorr(u,u) Cuu = xcorr(u,u)
Syu = welch_pgram(Cyu) Syu = welch_pgram(Cyu)
Suu = welch_pgram(Cuu) Suu = welch_pgram(Cuu)
return H = TF(Syu.power./Suu.power,Syu.freq) return H = TFdata(Syu.power./Suu.power,Syu.freq)
end end
tfest(iddata::IdData) = tfest(iddata.y,iddata.u)
N = 200000; N = 200000;
u = randn(N); u = randn(N);
y = filt(ones(30),30,u); y = filt(ones(5),5,u);
H = tfest(y,u); H = tfest(y,u);
loglog(H.f,abs(H.P)) semilogy(H.F,abs(H.P))
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