O'Reilly logo

GNU Octave by Jesper Schmidt Hansen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – revisiting the Sel'kov model

  1. In Chapter 5, we discussed how to solve a differential equation system using lsode. Specifically, we used lsode 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 variable global_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() ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required