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.
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.