Passing user-defined functions to octave integration routines

  • Thread starter Thread starter uart
  • Start date Start date
  • Tags Tags
    Octave
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
3 replies · 7K views
Science Advisor
Messages
2,797
Reaction score
21
Hi, appologies if this isn't the best forum for this question, I'd like to get some help (or find out where to get help) on using the open source "octave" maths program.

It's a very specific question, I have to find out how to allow included (library) functions to be able to access my user defined functions. When using the included numerical integration routines (say "quad.m" for example) they require a user function to be passed as a string. I can write the "m file" to define the user function and check that it works from the command line but I get an error any time that I try to pass this function to one of the integration routines like "quad". I'm sure there's a path or similar environment variable that I need to set, are there any octave users here that can give me a clue.

BTW, I'm running GNU octave 2.1.50 under Windows XP. I'm familiar with MATLAB and can easily make all this stuff work in matlab. It must be something simple to make it work in octave if I could just get started.
 
Physics news on Phys.org
Quick update.

Sorry there was some mis-information in the above. I was actually trying to use the routine called "quadc" and it wasn't working (and still isn't). But know I just tested the basic "quad" routine (called in exactly the same way as I was attempting to call quadc) and it actually does see my user function and does numerically integrate it correctly.

BTW. I made the user function as an "m" file in the "/octave_files" directory. I guessed that directory by typing "pwd" from the command line and that was what was indicated.

I'd still like some tips on the best path to place user "m" files and tips on good places to find online help if there are any octave users here. PS. Remeber I'm running under Windows and not Linux.

Thanks.
 
Yeah I still haven't resovled this. It looks like it works with "quad" because it's an inbuilt function but any functions that are implemented as "m" files don't seem able to see my user defined function. It must be a configuration problem.

Is anyone here using ocatave under Windows? I'm thinking maybe it just hasn't really been ported properly to windows.
 
You need to make sure your M files are in Octave's include path. I don't recall at the moment whether this is defined as an environment variable under Windows or specified in a config file. See http://www.octave.org/doc/octave_14.html#SEC103

A better place to ask might be the Octave forum over at Sourceforge.net
 
Last edited by a moderator: