Skip to content

Commit

Permalink
fix plr for MISO systems
Browse files Browse the repository at this point in the history
closes #171
  • Loading branch information
baggepinnen committed Jan 17, 2025
1 parent 6176e6b commit a8ebe4c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/arx.jl
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ function plr(d::AbstractIdData, na, nb, nc; initial_order = 20, method = :ls)
all(nb .<= na) || throw(DomainError(nb, "nb must be <= na"))
na >= 1 || throw(ArgumentError("na must be positive"))
# na -= 1
y_train, A = getARXregressor(y, u, initial_order, initial_order)
y_train, A = getARXregressor(y, u, initial_order, fill(initial_order, d.nu))
w1 = A \ y_train
yhat = A * w1
ehat = yhat - y_train
Expand Down
11 changes: 11 additions & 0 deletions test/test_arma_plr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@
@test freqresptest(G, Gwtls) < sqrt(eps())
@test freqresptest(G, Gplr) < sqrt(eps())

## MISO
G = tf(0.8, [1, -0.9], 1)
G = [G 2G]
u = randn(2,N)
y = lsim(G, u, t)[1]
e = randn(1,N)
yn = y + e
na, nb, nc = 1, [1, 1], 1
d = iddata(yn, u, 1)
Gplr, Gn = ControlSystemIdentification.plr(d, na, nb, nc, initial_order = 10)
@test freqresptest(G, Gplr) < 0.11
end

@testset "arma" begin
Expand Down

0 comments on commit a8ebe4c

Please sign in to comment.