How to embed the GNU Octave in C/C++ program?

Something like this embed.cpp #include <iostream> #include <octave/octave.h> int main(int argc,char* argv) {   int embedded;   octave_main(argc,argv,embedded=0);     return embedded; } Then mkoctfile embed.cpp –link-stand-alone -o embed in order to make a standalone executable. To call octave functions whether they are provided by scripts or octaveforge modules you can then use feval which takes the octave function name as … Read more

Plot window not responding

The problem is likely to be the graphics toolkit which your installation of Octave is using. To check this, type graphics_toolkit in the Octave command line. If the response is fltk and your plot window is freezing, then switch the default toolkit to gnuplot: graphics_toolkit(‘gnuplot’) Test that the problem is fixed: x=1:10; y=x.^2; plot(x,y) Make … Read more

How do I create a simple Octave distributable without installing Octave

Solution: Create a distributable exe using mkoctfile, and package this exe with the core Octave files, and other .oct and .m files as necessary. Step 1: Create a stand-alone executable. You can see code that works here: http://www.gnu.org/software/octave/doc/interpreter/Standalone-Programs.html Particularly the file “embedded.cc”. I have simplified that file as follows: #include <iostream> #include <octave/oct.h> #include <octave/octave.h> … Read more

Sweep / chirp signal ends at incorrect frequency

The following code explains how to generate a frequency-variable sin wave. freq1=20; %start freq freq2=200; %end freq dur=1; %duration of signal in seconds freq=@(t)freq1+(freq2-freq1)/dur*t; %another example, may help to understand the code %dur=2 %freq=@(t)heaviside(t-1)*10+heaviside(t-1.5)*-9; %Integerate over the time-local frequency, gives the average frequency until t which later on gives the sin with the right phase … Read more