Robotran C Documentation
Functions
rk4.c File Reference
#include "mbs_rk4.h"
#include "integrator.h"

Functions

int rk4 (double y[], double dydx[], int n, double x, double h, double yout[], int(*derivs)(double, double[], double[], MbsData *, MbsDirdyn *), MbsData *s, MbsDirdyn *dd)
 Runge Kutta 4 integrator implementation Given values for the variables y[1..n] and their derivatives dydx[1..n] known at x, use the fourth-order Runge-Kutta method to advance the solution over an interval h and return the incremented variables as yout[1..n], which need not be a distinct array from y. More...
 

Function Documentation

◆ rk4()

int rk4 ( double  y[],
double  dydx[],
int  n,
double  x,
double  h,
double  yout[],
int(*)(double, double[], double[], MbsData *, MbsDirdyn *)  derivs,
MbsData s,
MbsDirdyn dd 
)

Runge Kutta 4 integrator implementation Given values for the variables y[1..n] and their derivatives dydx[1..n] known at x, use the fourth-order Runge-Kutta method to advance the solution over an interval h and return the incremented variables as yout[1..n], which need not be a distinct array from y.

The user supplies the routine derivs(x,y,dydx), which returns derivatives dydx at x.

Parameters
ystate vector of variable
dydxderivative of y by x
nnumber of variables
xcurrent time value, at which the function needs to be computed
htime step
youtsolution of the incremented variables
derivsThe function computing f'
sthe MbsData structure of the model on which dirdyn analysis is computed.
ddthe MbsDirdyn structure related to the integration.
Returns
Error status, <0 in case of failure.