1
votes

I'm trying to solve a system of DAE (mixture of ODE and Algebraic Eq). So, my system looks like this

M dy/dt = F(t,y)

The matrix M is basically a constant mass matrix 1 in the diagonal with all zeros on the few last lines and few last column.

so for an example mass matrix looks like this

M = [1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0]

my vector Fx is in dimension (4x1) if we take the matrix example.

How do I proceed if I get this error?

Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND = NaN

my code for the system resolution :

Mass = Mass_Matrix( Nc,NT );

opt = odeset('RelTol', 10.0^(-3), 'AbsTol' , 10.0^(-3), 'Mass', Mass ,'MassSingular', 'yes', 'OutputFcn',@odeprint);

[T,Y] = ode15s(@(t,y)Function_Fx( t, y, Resolution, y01),[0 1],y0,opt);

and my vector Fx is created by the Function_Fx

function Fx = Function_Fx( t, y, Resolution, y01)

With Resolution being a struct variables, and y01 a stored values.

My question is where could be the problem, is it the F(t,y) or the M? Given M is constant mass matrix.

Thank you for your help

1
please post a complete example with definition of Function_Fx and values for all used variables (Mass, t, y, Resolution, y01, y01). otherwise no one can reproduce your problemm.s.
My question is where could be the problem, is it the F(t,y) or the M? Given M is constant mass matrix.S. A.
Well, you M is singular, so quite clearly the problem is M. Simply put, your differential equation system does not specify the derivative of the y(4).A. Donda

1 Answers

0
votes

I've solved this problem. It was because my F(t,y) is wrong. I checked the jacobian only by then I managed to see that I have some lines of zeros.