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 个评论
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.
https://www.mathworks.com/help/symbolic/analyze-and-manipulate-differential-algebraic-equations.html
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 Center 和 File 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!