# error occurring while solving odes using ode15s

조회 수: 2 (최근 30일)
Meenakshi Tripathi 2021년 4월 8일
댓글: Torsten 2023년 1월 5일
function comb_thesis
clc
clear all
global E A B
E = [-3.6264 3.5447 -4.8625 zeros(1,8);-0.3148 -1.9197 -1.1648 zeros(1,8);zeros(3) eye(3) zeros(3,5);zeros(6,11)]
A = [8.5970 -8.3254 9.8331 zeros(1,8);1.0280 2.9897 1.8778 zeros(1,8);zeros(1,3) -0.75 -1 0.25 zeros(1,3) 51.3257 11.2723;zeros(1,3) 0 -2 0 zeros(1,3) 41.5581 7.8378;zeros(1,3) 0.25 1 -0.75 zeros(1,3) -24.3673 -6.2663;zeros(1,3) eye(1,3) -eye(1,3) -0.4488 2.4167;zeros(1,3) 0 1 0 0 -1 0 -0.0898 0.4833;zeros(1,3) 0 0 1 0 0 -1 0.2693 -1.4500;-0.1857 0 -0.1857 zeros(1,6) -eye(1,2);10 0 10 zeros(1,6) 0 -1;zeros(1,11)]
B = [-0.7306 -0.8299 -0.5319;0.4742 0.0304 1.3620;0.0517 -0.2759 0.7068;-0.2241 -0.1379 -0.3965;-0.0517 0.2759 -0.7068;zeros(3);zeros(3)]
tspan = 0:0.1:20;
x0 = [1 0 -1 10 11 6 zeros(1,5)];
size(x0)
opt = odeset('RelTol', 1e-6,'Mass',E);
[~,x] = ode15s(@ode,tspan,x0,opt);
end
function dxdt = ode(t,x)
global A B
dxdt = A*x + B*[exp(-t)*sin(t);0.2*sin(2*t);0.2*sin(3*t)]
end
Errors are-
Error using daeic12 (line 76)
This DAE appears to be of index greater than 1.
Error in ode15s (line 310)
[y,yp,f0,dfdy,nFE,nPD,Jfac] = daeic12(odeFcn,odeArgs,t,ICtype,Mt,y,yp0,f0,...
Error in comb_thesis (line 12)
[~,x] = ode15s(@ode,tspan,x0,opt);
##### 댓글 수: 4이전 댓글 2개 표시이전 댓글 2개 숨기기
Stephen23 2021년 4월 8일
"What about error that i am facing up?"
Check, double check, triple check your matrices! Perhaps write them in table or CSV file which you can import, just so that they can be written explicitly in a way that can be reviewed visually.
Check the behavior of the ODE you are trying to solve: is it suitable for the solver you have chosen?
Meenakshi Tripathi 2021년 4월 8일
yes ode15s is suitable for this kind of odes.

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

### 채택된 답변

Bjorn Gustavsson 2021년 4월 8일
Check your mass-matrix E and make sure it looks exactly like you expect. The 3 off-diagonal 1s looks peculiar to me. Then you have to read up on the use of the mass-matrix in the documentation, there are rather strict constraints on what type of algebraic equations you can send in to the ODE-functions. Yours might be too complicated.
(
Also remove the globals, just define the ode-function like this instead:
function dxdt = ode(t,x,A,B)
dxdt = A*x + B*[exp(-t)*sin(t);0.2*sin(2*t);0.2*sin(3*t)];
end
and call it like this:
[~,x] = ode15s(@(t,x) ode(t,x,A,B),tspan,x0,opt);
)
HTH
##### 댓글 수: 4이전 댓글 2개 표시이전 댓글 2개 숨기기
Meenakshi Tripathi 2021년 4월 8일
편집: Meenakshi Tripathi 2021년 4월 8일
Ok Thank you!!!
''See the documentation'' where i will find this?
when i solved same kind of problem taking 5 by 5 matrix then my result was showing up but when i am doing same for 11 by 11 matrix then i am getting error ''This DAE appears to be of index greater than 1.''
Now what can be done?
Bjorn Gustavsson 2021년 4월 9일
편집: Bjorn Gustavsson 2021년 4월 9일
You might find your way forward from this link: Solve-Differential-Algebraic-Equations, and this:
When I've had to solve equations of motion in complicated conservative force-fields (where total particle energy is conserved) I'd switched to completely different ODE-integrating schemes (Boris-mover, etc). Since it is not perfectly clear to me what your DAE-system is in that sense I cannot give much better/more extensive advice than this.

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

### 추가 답변 (1개)

Sr 2023년 1월 5일
hello, I got the same problem. Have you solved this problem? Any information about this will be appreciated.
##### 댓글 수: 1이전 댓글 -1개 표시이전 댓글 -1개 숨기기
Torsten 2023년 1월 5일
Include your code for which the problem appears.

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

### 카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

### Community Treasure Hunt

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

Start Hunting!

Translated by