[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: control problem: lsim
From: |
Lukas Reichlin |
Subject: |
Re: control problem: lsim |
Date: |
Mon, 25 Feb 2013 07:45:48 +0100 |
On 24.02.2013, at 23:17, Rudolf Widmer-Schnidrig <address@hidden> wrote:
> Dear Lukas, dear List,
>
> What is the best way to evaluate the quality of a LTI model
> which I have obtained like this
>
> octave> dat = iddata(yout,xin); % yout is observed output to input xin
> octave> sys = arx (dat,'NA',2,'NB',1')
>
> From the control manual I expected that I could run
>
> octave> lsim(sys,xin)
>
> to predict the output for input xin given the system sys.
>
> but I get the error: lsim: input vector u must have 2 columns
>
> what am missing?
>
> many thanks in advance, -Ruedi
Hi Ruedi,
If dat has p outputs and m inputs,
[n, p, m, e] = size (dat)
[n, p] = size (yout)
[n, m] = size (xin)
sys becomes an p by m+p LTI model (p outputs and m+p inputs).
The first m inputs (1:m) are u(t) and the remaining p inputs (m+(1:p)) are e(t)
A(q) y(t) = B(q) u(t) + e(t)
You are only interested in u(t), therefore select the inputs by sys(:, 1:m)
lsim (sys(:, 1:m), xin)
Maybe I should improve the documentation of arx.
Best regards,
Lukas