DanielMartensson / MataveID

System identification toolbox for GNU Octave and MATLAB
MIT License
82 stars 25 forks source link

A question about OKID in practice #4

Closed VigourJin closed 3 years ago

VigourJin commented 3 years ago

Dear Professor, Thanks for your sharing your codes. I have a problem when I use OKID in practice.

Here is the problem: error: svd: cannot take SVD of matrix containing Inf or NaN values error: called from okid >eradcokid at line 200 column 11 okid at line 142 column 13 OKID_motor at line 24 column 11

The reason is the following function has no output. Ybar = y_partinv(V'V + regularizationeye(size(V'V)))*V';

Here is the output on terminal Ybar = Columns 1 through 37: NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Columns 38 through 74: NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ... ... ...

How should I fix this problem? Thanks again. Regards

DanielMartensson commented 3 years ago

Dear Professor, Thanks for your sharing your codes. I have a problem when I use OKID in practice.

Here is the problem: error: svd: cannot take SVD of matrix containing Inf or NaN values error: called from okid >eradcokid at line 200 column 11 okid at line 142 column 13 OKID_motor at line 24 column 11

The reason is the following function has no output. Ybar = y_partinv(V'_V + regularization_eye(size(V'V)))*V';

Here is the output on terminal Ybar = Columns 1 through 37: NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Columns 38 through 74: NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ... ... ...

How should I fix this problem? Thanks again. Regards

Show me your code.

Notice that OKID has been updated too. The old OKID is available, but very sensitive to noise. The current OKID is very robust because it's pure linear algebra.

VigourJin commented 3 years ago

Dear Professor, Thanks for your sharing your codes. I have a problem when I use OKID in practice. Here is the problem: error: svd: cannot take SVD of matrix containing Inf or NaN values error: called from okid >eradcokid at line 200 column 11 okid at line 142 column 13 OKID_motor at line 24 column 11 The reason is the following function has no output. Ybar = y_partinv(V'_V + regularization_eye(size(V'V)))*V'; Here is the output on terminal Ybar = Columns 1 through 37: NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Columns 38 through 74: NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ... ... ... How should I fix this problem? Thanks again. Regards

Show me your code.

Notice that OKID has been updated too. The old OKID is available, but very sensitive to noise. The current OKID is very robust because it's pure linear algebra.

Thanks for your reply. I have noticed the new OKID, but I can not understand it. Are there any recommended articles to understand the current OKID?

DanielMartensson commented 3 years ago

Thanks for your reply. I have noticed the new OKID, but I can not understand it. Are there any recommended articles to understand the current OKID?

Yes, there are. Read the lecture notes here: https://github.com/DanielMartensson/Mataveid/tree/master/reports

Beware! Even if these methods are very clear and fun to do, they are quite obsolete because Realization Theory is very sensitive to noise and delay. Especially when you are doing MIMO system identification.

So this OKID, I made by my self, is robust against noise because it a more simplified OKID and it later uses Algebraic Riccati Equations to find the Kalman filter gain matrix K.

I have tried OKID from the lecture notes and they won't work if you got a lot of noise. So I modify OKID a little bit.

For SISO system identification, I recommend RLS every day because it's easy and it gives a very good model, due to noise and some small nonlinearities. For MIMO system identification, I recommend SINDy algoritm for nonlinear problems.

VigourJin commented 3 years ago

Thanks for your reply. I have noticed the new OKID, but I can not understand it. Are there any recommended articles to understand the current OKID?

Yes, there are. Read the lecture notes here: https://github.com/DanielMartensson/Mataveid/tree/master/reports

Beware! Even if these methods are very clear and fun to do, they are quite obsolete because Realization Theory is very sensitive to noise and delay. Especially when you are doing MIMO system identification.

So this OKID, I made by my self, is robust against noise because it a more simplified OKID and it later uses Algebraic Riccati Equations to find the Kalman filter gain matrix K.

I have tried OKID from the lecture notes and they won't work if you got a lot of noise. So I modify OKID a little bit.

For SISO system identification, I recommend RLS every day because it's easy and it gives a very good model, due to noise and some small nonlinearities. For MIMO system identification, I recommend SINDy algoritm for nonlinear problems.

Ok, Thank you for your suggestion. I will try them.