CPCLAB-UNIPI / SIPPY

Systems Identification Package for PYthon
GNU Lesser General Public License v3.0
269 stars 92 forks source link

MOESP and N4SID not always working #8

Open Jelmer44 opened 5 years ago

Jelmer44 commented 5 years ago

I'm trying to use this for my thesis, but the MOESP and N4SID algorithms seem not to give the right values. I'm using an input u in the form u = 5 * sin(0.3t) computing the output through scipy.signal.dlsim and my matrices have the form A = [0 1;-a -b] B = [0;1], C= [0, 1], D=0 with a and b between 0 and 2. The generated matrices by the MOESP and N4SID are very far off, I'm not an experted in this field, do you have any idea why it is not working? They are accurate when I'm using an input of random variables between [-0.5,0.5].

CPCLAB-UNIPI commented 5 years ago

Dear Jelmer44, sorry for the delay in our reply.

To answer your issue please consider two different aspects which make your generated matrices different from the actual ones.

1) sinusoidal inputs are surely less informative than specific input signals as PRBS (pseudo-random binary signal) or GBN (generalized binary noise), as they only excite your system at the unique frequency of the input (0.3 in your case).

2) In addition, note that when you are identifying a input-output model (e.g., transfer functions TF), there is only one correct model which corresponds exactly to your actual dynamics. Otherwise, when managing with state-space (SS) models, there are infinite similar models which correspond to your actual dynamics. Note that transformation from SS to TF is unique, while the opposite in not, as there are infinite transformations called "realizations" and infinite SS systems similar by a base-matrix T.

Consider the following Input-output equivalence between two state-space models (with same number of states): original system xk+1 = Axk + Buk yk = Cxk + Duk

similar system with zk = T xk zk+1 = TAT^{-1}zk + TBuk = At zk + Bt uk yk = CT^{-1}zk + Duk = Ct zk + D uk

Invariant parameters: D does not change A and At have same eigenvalues (poles of G(z)) Gain matrix G(1) = C(I - A)^{-1}B + D is the same Gt (1) = Ct (I - At)^{-1}Bt + Dt

Therefore, your identified systems may be all similar to the actual one.

Hoping to have clarified all your doubts. Best