Time for action – revisiting the Sel'kov model
- In Chapter 5, we discussed how to solve a differential equation system using
lsode
. Specifically, we usedlsode
to solve the Sel'kov model. There the differential equation system was specified in an m-function, but we can also implement it using the C++ interface. Recall that in the original function, we used the global variableglobal_b
in the function, so the C++ implementation needs to retrieve this variable from the Octave workspace as well.Code Listing 8.5 #include <octave/oct.h> #1 #2 DEFUN_DLD(selkovo, argv, , “Usage: y = selkovo(x)"){ #3 octave_value_list retval; #4 #5 octave_value boct = get_global_value("global_b"); #6 double b = boct.scalar_value(); #7 #8 ColumnVector x( argv(0).vector_value() ...
Get GNU Octave now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.