Changeset 2221 in ntrip for trunk/BNC/bncutils.cpp
- Timestamp:
- Jan 12, 2010, 8:36:29 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/bncutils.cpp
r2065 r2221 243 243 + sinPhi * xyz[2]; 244 244 } 245 246 // Fourth order Runge-Kutta numerical integrator for ODEs 247 //////////////////////////////////////////////////////////////////////////// 248 ColumnVector rungeKutta4( 249 double xi, // the initial x-value 250 const ColumnVector& yi, // vector of the initial y-values 251 double dx, // the step size for the integration 252 ColumnVector (*der)(double x, const ColumnVector& y) 253 // A pointer to a function that computes the 254 // derivative of a function at a point (x,y) 255 ) { 256 257 ColumnVector k1 = der(xi , yi ) * dx; 258 ColumnVector k2 = der(xi+dx/2.0, yi+k1/2.0) * dx; 259 ColumnVector k3 = der(xi+dx/2.0, yi+k2/2.0) * dx; 260 ColumnVector k4 = der(xi+dx , yi+k3 ) * dx; 261 262 ColumnVector yf = yi + k1/6.0 + k2/3.0 + k3/3.0 + k4/6.0; 263 264 return yf; 265 } 266
Note:
See TracChangeset
for help on using the changeset viewer.