Linearizing Symulink dynamic model to retrieve coefficient matrices A B C D (without using linmod function) with Least Squares method

6 次查看(过去 30 天)
Adrian Tworek
Adrian Tworek2022-5-27
评论: Sam Chak ,2022-5-30,12:21
Hello,
I wonder how to implement linearazing the dynamic model from simulink to the linear one. I know that there are built-in functions, however, I have to implement this from scratch using Least Squares method.
The model consists of two fluid tanks with free drainage. The maximum height of tank is 15m, which I have already done in Simulink.
Subsystem
I have to use h1, h2, h1_p (derivate of h1), h2_p (derivate of h2), and "u", which is my Qwe (input signal 5.373)
Could you help me to implement the "Least Squares" method to retrieve A, B, C, D matrices that are part of the linear model?
My start program:
  3 个评论
Sam Chak
Sam Chak 2022-5-30,12:21
Thanks for the ODEs. I know that least squares method is commonly used in curve-fitting problems, dealing with sparse matrices, and data-driven system identification. But the linearization method that I know of usually involves finding the Jacobian.
Perhaps you can first create the symbolic differential equations. Follow the examples here.
syms h1(t) h2(t) Q S1 S2 Sw1 Sw2 phi1 phi2 g
ode1 = diff(h1) == Q/S1 - (Sw1*phi1*sqrt(2*g*(h1 - h2)))/S1;
ode2 = diff(h2) == (Sw1*phi1*sqrt(2*g*(h1 - h2)))/S2 - (Sw2*phi2*sqrt(2*g*h2))/S2;
odes = [ode1; ode2]
Let's hope other users who are good at math/physics/MATLAB can help out.

请先登录,再进行评论。

回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by