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

10 次查看(过去 30 天)
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 个评论
Adrian Tworek
Adrian Tworek 2022-5-28
Hi Sam,
here are the differential equations:
Everything works perfectly in Simulink. Initial condition in both tanks integrators is 0.
The main purpose is to retrieve linear matrices (A, B, C, D) without using any built-in functions that return them immediately in one line (like linmod etc.). It has to be calculated in matlab file using Least Square method and h1, h2, h1_derivative, h2_derivate and input signal (Qwe).
Thank you for help!
Sam Chak
Sam Chak 2022-5-30
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 个)

类别

Help CenterFile Exchange 中查找有关 Numerical Integration and Differential Equations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by