Solving a system of 6 DAEs of first order - index error

1 次查看(过去 30 天)
Hello, I'm trying to solve follofing system
%constants
syms a b c d e f g h i
%variables
syms s(t) u(t) v(t) w(t) x(t) y(t) z(t)
ddt(1) = diff(w(t)) == c;
ddt(2) = diff(x(t)) == - y(t) + a + b;
ddt(3) = diff(s(t)) + e*diff(v(t)) == f+ g- c;
ddt(4) = 0 == s(t) - w(t)*e;
ddt(5) = 0 == u(t) - x(t)*e;
ddt(6) = 0 == v(t) + z(t) - d;
ddt(7) = diff(u) == i + a*g + b*h - y(t);
vars = [ y(t); w(t);v(t); z(t); x(t); u(t); s(t)];
[eqns,vars] = reduceDifferentialOrder(ddt,vars);
isLowIndexDAE(eqns,vars)
I get the answer that the system is of index two and cannot be solved. The problem lies in the equation 7. Specifically, i doesn't seem to like calculating y(t). Why is that and how can I get it to work?
I have tried using reduceDifferentialOrder(ddt,vars) but the equations did not make any sence physically. It would help a lot if I could also understand why it doesn't work

采纳的回答

Torsten
Torsten 2023-10-15
编辑:Torsten 2023-10-15
The reason why it doesn't work is that you don't have an equation that directly solves for y.
Equation (1) solves for w, equation (2) solves for x, equation (4) solves for s, equation (5) solves for u, equation (3) solves for v, equation (6) solves for z. So equation (7) must solve for y, but it's too difficult for the solver to get diff(u(t)) from the other equations.
From equation (5), it follows that
diff(u(t)) = e*diff(x(t))
Inserting diff(x(t)) from equation (2) gives
i + a*g + b*h - y(t) = e*(- y(t) + a + b)
thus
y(t) = (i + a*g + b*h - e*(a+b))/(1-e)
So if you remove equation (7) and insert this constant for y(t), it should work.
  2 个评论
VS
VS 2023-10-15
Thank you! I did always wonder why some equatons work and some not, even when the meaning is the same.
Torsten
Torsten 2023-10-15
编辑:Torsten 2023-10-15
One should always be able to say which equation solves for which variable. If one has problems with this assignment, the solver will have even bigger problems with this task.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by