Implementation of High Order DAE for Matlab Solver

1 次查看(过去 30 天)
Hi,
I got three variables y1(t), y2(t) and y3(t) which I want to solve for. Moreover I have two ODEs in explicit and coupled form and one algebraic equation , which look as follows:
1. Eqn: y1''' = f(y1'', y1', y1, y2'', y2', y2, u)
2. Eqn: y3'' = f(y1', y1, y2'', y2', y2, y3', y3, u)
3. Eqn: y1 = y2 + y3
u is my input which is a cosine function with amplitude U_g
I want to use ode15s() to solve this system if its correct, with a Mass Matrix M and a form like
M(t,y)*y= f(t,y)
Therefore I have to reduce the order of the above equations first.
Now my function looks like the following, where "d" represents first differential and "dd" the 2nd differential:
function out = myodefunc(t, y, U_g, R_e, L_e, M_m, bl_0, bl_1, ...)
out = zeros(8, 1);
% Reduce Order of Diffenrential Equations
y1 = y(1);
dy1 = y(2);
ddy1 = y(3);
y2 = y(4);
dy2 = y(5);
ddy2 = y(6);
y3 = y(7);
dy3 = y(8);
% Define Output
out(1) = y1 - y2 - y3;
out(2) = dy1;
out(3) = ddy1;
out(4) = -(bl_0^3*dy1 - bl_0^2*U_g*cos(2*pi*f0.*t) + bl_1^3*y1^3*dy1 + bl_2^3*y1^6*dy1 - bl_1^2*U_g*cos(2*pi*f0.*t)*y1^2 - ...
out(5) = dy2;
out(6) = ddy2;
out(7) = dy3;
out(8) = (L_e*bl_0*s_s_0*dy2 - L_e*bl_0*s_v_0*dy3 + R_e*bl_0*r_s_0*dy2 - R_e*bl_0*r_v_0*dy3 + R_e*bl_0*s_s_0*y2 - R_e*bl_0*s_v_0*y3 + -...
end
With a Mass Matrix :
M =
0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0
0 0 1 0 0 0 0 0
0 0 0 1 0 0 0 0
0 0 0 0 1 0 0 0
0 0 0 0 0 1 0 0
0 0 0 0 0 0 1 0
0 0 0 0 0 0 0 1
Do you guys think, that I implemented this in the right way?
Mainly I am concerned about the algebraic equation, which is in the first line of the output. It's because I get zero output for out(2), out(3), out(5) and out(6).

采纳的回答

Torsten
Torsten 2015-3-9
I guess your DAE system is of higher index than 1.
You can check this:
Best wishes
Torsten.
  1 个评论
Helge
Helge 2015-3-17
Hi Torsten, just a quick reply on your answer. I succesfully implemented my DAE system by walking through the following manual: http://de.mathworks.com/help/symbolic/set-up-your-dae-problem.html
This is avaible for Symbolic Math Toolbox users in Matlab2015a. It is very straight forward method for implementing equation systems in Matlab and super helpful, Well Done!

请先登录,再进行评论。

更多回答(0 个)

类别

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

产品

Community Treasure Hunt

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

Start Hunting!

Translated by