Reputation: 877
As the title says I'd like to know how to retrieve the 2nd order derivative from a Matlab ode. The system i'm trying to simulate is described by 12 1st order differential equations.
Let's explain:
...
[T,Y] = ode113(@sixdofsolver,time,Y0,options,settings);
T = 1700x1 vector
Y = 1700x12 matrix
Now if i do:
[dY] = sixdofsolver(T,Y,settings)
dY = 12x1 vector
I'd have expected to have a same-size matrix like Y.
What am I doing wrong?
Upvotes: 0
Views: 58
Reputation: 18484
You're on the right track. Your integration function sixdofsolver
is likely designed first for used by Matlab's ODE solvers. These functions evaluate the function at one point in time (and a single state value) rather than across a range of times.
You either need to rewrite your sixdofsolver
function so that it can handle more than a single time or your need to create a new function based on it that does that. In other words you need to vectorize the integration function. You probably have variable like y(1)
, y(2)
, ..., y(12). Well, now the input state vector is a matrix so you need to use something like
y(:,1),
y(:,2), ..., y(:,12)
. You may need to do other things like switch to element-wise operators. I can't help you more from what you've provided.
Upvotes: 2