Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MISO ARX with multiple iddata #161

Closed
bertrandkerres opened this issue Oct 27, 2024 · 2 comments
Closed

MISO ARX with multiple iddata #161

bertrandkerres opened this issue Oct 27, 2024 · 2 comments

Comments

@bertrandkerres
Copy link

Hello again :),

I was trying to estimate MISO arx models from multiple iddata instances, and I'm encountering a problem with the broadcasting.

MWE (some parts proudly stolen from your docs):

using ControlSystemsBase
using ControlSystemIdentification

N  = 2000     # Number of time steps
t  = 1:N
Δt = 1        # Sample time
u  = randn(2, N) # A random control input

G  = ssrand(1, size(u, 1), size(u, 1); Ts=Δt)
y  = lsim(G, u, t)[1][:]
d  = iddata(y, u, Δt)

na = 1
nb = [1, 1]

GIs = arx([d, d], na, nb)          # will also broadcast internally over nb it seems
Gls = arx([d, d], na, Ref(nb)) # will complain about the inputdelay default

I could fix my specific example by iterating instead of broadcasting over getARXregressor (within arx), but I'm not so familiar with the API conventions so I don't know whether that is acceptable as solution in general.

@baggepinnen
Copy link
Owner

This should be fixed by

Note the arguments passed to arx in the test to make the two models equivalent. Your random statespace model G has inputdelay = 0 since it has a non-zero $D$ matrix. It also has na = 2 since it is of order 2, and nb = 3 since it may have 2 zeros = 3 parameters in the numerator polynomial.

@bertrandkerres
Copy link
Author

Ah, right, thanks for the help 🤓 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants