How to add “nonnegative” to DAE

조회 수: 3 (최근 30일)
Linux Jia
Linux Jia 2022년 4월 22일
댓글: Torsten 2022년 8월 13일
I have solved the DAE solution using ODE15i, but the data in the result is negative. I need to solve for the angle and I need the angle and the velocity to be non-negative. But you can not apply the "non-negative" option when solving DAE problems. And I have tried to reduce "ReTol" and "AbsTol", but I still do not get ideal results. Do you have any other plans?
  댓글 수: 26
Linux Jia
Linux Jia 2022년 4월 26일
I'm not rambling, two workarounds have been suggested in matlab answers before. The first is to reduce the integration tolerance, and the second is to add judgment in the integrator. If a variable is negative, set its value to a very small value. Also, this person seems to be you. ^-^
Bruno Luong
Bruno Luong 2022년 4월 26일
편집: Bruno Luong 2022년 4월 26일
It looks to me that the system might have multiple solutions, and it is hard to catch the solution that is positive.
I would suggest then to start with a positve state phi_{k=0), then slowly iterate until your target DAE meets. Here is a pseudo code:
phi_{k=0) >= 0; % and also the 3 last equations
alpha = some value in (0,1)
for k=1,2,...
Qp = ComputeQ(phi{k-1})
% Use phi{k-1} as first guess solve DAE with RHS set to
d(xxx)/dt ... = (1-alpha)*Qp + alpha*Q;
if phi_{k} < 0
alpha = (0+alpha)/2; % reduce alpha;
else
alpha = (1+alpha)/2; % eventually increase alpha
end
if alpha ~= 1
% we solve the DAE approximately
break
end
end

댓글을 달려면 로그인하십시오.

채택된 답변

Linux Jia
Linux Jia 2022년 4월 27일
I added a judgment statement to the handle function of the solver, and if the angular velocity is negative, set its value to an extremely small value. The program can continue to run, but when the time of the program reaches a certain point, it prompts that the step size needs to be reduced to meet the integration tolerance requirements. So how should this situation be handled? If the last numerical solution of this integration is used as the guessed initial value of the next integration, it will be found that its initial value has changed after passing decic. As a result, the junction of the two integrals will not be smooth. So, is there any good way to deal with it?
  댓글 수: 1
Torsten
Torsten 2022년 4월 27일
편집: Torsten 2022년 4월 27일
From the time instant when you artificially reset the angular velocity to a small value, the numerical values you receive for the solution variables will no longer be solutions of the DAE-system. That's why decic produces a change in the initial values when you try to restart the solver. I think you will have to accept this.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Linux Jia
Linux Jia 2022년 8월 12일
The integral does not converge because the mathematical model is wrong.
  댓글 수: 1
Torsten
Torsten 2022년 8월 13일
And how did you find it out ?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by