use of odeset with matlab c++

S

shyam

Hi,
I am trying to use ode45 in c++ using the matlab library functions. I
am trying to use a mass matrix using the odeset property. First i tried
the code without setting a mass matrix. Here is a sample :
options = odeset("RelTol",0.0001,"AbsTol",0.0001);
.
.
t = ode45(&y,"rigid",tspan,y0,options);

This part works and i get an answer but as soon as i try to introduce a
mass matrix the code fails to execute:
//function to integrate
mwArray rigid(mwArray t,mwArray y)
{
mwArray dy;
dy(1) = y(1); // a column vector
return (dy);
}

//mass matrix
mwArray massmat(mwArray t,mwArray y)
{
mwArray M;
M(1,1) = 1; // a column vector
return (M);
}

DECLARE_FEVAL_TABLE
FEVAL_ENTRY(rigid);
FEVAL_ENTRY(massmat);
END_FEVAL_TABLE
options = odeset("Mass","massmat","RelTol",0.0001,"AbsTol",0.0001);
.
.
t = ode45(&y,"rigid",tspan,y0,options);

Is there something wrong in the way that i refer to the function used
in the mass matrix(massmat) ??
Thanks in advance, shyam.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,002
Messages
2,570,261
Members
46,858
Latest member
FlorrieTuf

Latest Threads

Top