Closed Anweizhen closed 4 years ago
Hello! Sorry for the late reply.
u is the input signal from your mesurements and y is the output signal.
lsim(G, u, t) is linear simulation of transfer function G or statespace model sys, u = input and t = time vector.
Dear Professor, is it possible to use OKID for MISO systems? i tried to use it but i get the following error: error: toeplitz: C must be a vector error: called from toeplitz at line 70 column 7 okid at line 49 column 5 Regards
Sorry. I haven't implement it yet.
But I have an idea if you want to do a pullrequest.
OKID computes the impulse response, but only for siso-case. If you want to have MIMO-case, you should have a for-loop around the OKID algorithm part only.
Then it should work. ERA algorithm can do MIMO, but I think i need to tell the correct sizes first. Right now it assumes that the impulse response is only SISO.
I don't know why I made OKID SISO. Perhaps because I use the C++ bult in routines.
OKID is my favorite algorithm. Works every time. But N4SID and MOESP can do MIMO. They requries more tuning and more data. They are better if you got noise.
OKID is good for more industrial basic stuffs that are nonlinear. Yes, you can do nonlinear models on a linear state space representation.
Just overfitt it by select a large number during estimation. Don't do that if you got noise. You will included the noise into the input signal.
thanks again for your generosity and sharing your codes with everyone. I am a Mechanical Engineer in Germany, writing my Master Thesis about different mehtods of System Identification. One of the Methods I'm researching is OKID. I have a system with 6 inputs (Speed, Acceleration, Yawrate and some other signals from a vehicle) and one output (Force on Cross tie). Unfortunately I don't get a proper solution using OKID-Algo (i used the codes of Steve Brunton) , so I thought it might be a weakness of OKID. Is there any specific limitation for using this algorithm? I read lots of papers but i couldn't find anything helpful, so it would be really nice if you could help me as an expert in this field. Thanks again and I would really appreciate your answer.
thanks again for your generosity and sharing your codes with everyone. I am a Mechanical Engineer in Germany, writing my Master Thesis about different mehtods of System Identification. One of the Methods I'm researching is OKID. I have a system with 6 inputs (Speed, Acceleration, Yawrate and some other signals from a vehicle) and one output (Force on Cross tie). Unfortunately I don't get a proper solution using OKID-Algo (i used the codes of Steve Brunton) , so I thought it might be a weakness of OKID. Is there any specific limitation for using this algorithm? I read lots of papers but i couldn't find anything helpful, so it would be really nice if you could help me as an expert in this field. Thanks again and I would really appreciate your answer.
The OKID algorithm computes first the impulse response of your inputs. It uses the singular value decomposition, e.g least squares in practice.
Then when you got the impulse response, you use the Eigensystem Realization Algorithm(ERA) to compute the dynamical state space model.
Here is how you find the MIMO impulse response for OKID.
# Se till att du har mataveID and MataveControl installerad
# Skapa en modell
sys = ss(0, [0 1 0 0; -2 -1 0 0; 0 0 0 1; 0 0 -1.4 -0.5], [0 0; 1 0; 0 0; 0 1], [1 0 0 0; 0 0 1 0])
# Simulera modellen
u1 = linspace(4,4, 100);
u2 = linspace(2,2, 100);
t = linspace(0, 20, 100); % 20 sekunder
y = lsim(sys, [u1; u2], t);
# Identifiera med OKID - Toeplitz matrix
g1 = y(1,:)*pinv(triu(toeplitz(u1)));
g2 = y(2,:)*pinv(triu(toeplitz(u2)));
plot(t, g1, t, g2);
But then you need to implement this impulse response into the ERA algorithm. The ERA algorhtm is also singular value decomposition. E.g least square.
Step 1: Run the code above.
Step 2: Change those lines in okid.m or era.m files
% Create hankel matrecies
H0 = hank(g, 1);
H1 = hank(g, 2);
So they will contain the MIMO impulse response.
Have a look at equation (9) here. Create a hankel matrix of hank([g1; g2], 1) and then hank([g1;g2], 2) https://github.com/DanielMartensson/Mataveid/blob/master/reports/EigensystemRealization.pdf
Try do use a double for-loop to use the first of [g1; g2] to create the first element of the hankel matrix. Notice that if you got X impulse responses, then the hankel matrix is going to have the dimension (N+X-1)x(N), where the N is the column length and X is the amount of impulse responses.
thanks again for your generosity and sharing your codes with everyone. I am a Mechanical Engineer in Germany, writing my Master Thesis about different mehtods of System Identification. One of the Methods I'm researching is OKID. I have a system with 6 inputs (Speed, Acceleration, Yawrate and some other signals from a vehicle) and one output (Force on Cross tie). Unfortunately I don't get a proper solution using OKID-Algo (i used the codes of Steve Brunton) , so I thought it might be a weakness of OKID. Is there any specific limitation for using this algorithm? I read lots of papers but i couldn't find anything helpful, so it would be really nice if you could help me as an expert in this field. Thanks again and I would really appreciate your answer.
Hi!
Updated now. Look at okid.m
:)
Bästa hälsningar Daniel
Dear Professor, is it possible to use OKID for MISO systems? i tried to use it but i get the following error: error: toeplitz: C must be a vector error: called from toeplitz at line 70 column 7 okid at line 49 column 5 Regards
OKID updated now. Try it.
Dear professor, It's generous of you to share this project . But I have a question that what is the specific value of input(u) in README.md, such as command lsim(G, u, t). I'm a beginner, it's a little diffcult for me to guess the value of u. Can you upload a more detailed version of 'Typical use' at your convenience or just tell me the value of u?