Warning: Parameter 1 to SyntaxHighlight_GeSHi::configureParser() expected to be a reference, value given in /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/Hooks.php on line 207

Warning: Parameter 1 to SyntaxHighlight_GeSHi::resourceLoaderRegisterModules() expected to be a reference, value given in /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/Hooks.php on line 207
User-Supplied Plain Text Function Formats - Rave Documentation

User-Supplied Plain Text Function Formats

From Rave Documentation
Jump to: navigation, search

Rave can load simple "plain text" functions that meet the following criteria:

  • The function calculates a single output variable. It may have any number of input variables.
  • The function involves only basic math operators: + - * / ^ abs(), sin(), cos(), log() etc...
  • The function can theoretically be represented as a single statement (line) of MATLAB code. I.e. it cannot involve "if" statements, "for" loops etc.
  • The names of all input variables are legal matlab variable names. This generally means they must begin with a letter and cannot contain symbols (other than _) or spaces.

Rave can load plain text functions either from a .txt file, or you can type/paste them into a dialog box. In either case, the content of the function should be only the right hand side of the equals sign. For example, if you have the function y = x1 + x2, you would use only "x1+x2" as the content of the function. You will supply the name of the output variable when you load the function into Rave.

  • Tip: If you are loading a function stored in a .txt file, Rave will suggest the file name as the default variable name. So you can save time by using the functional variable's names as your file names.
  • Developer tip: The function that Rave uses to convert plain text files to .m files is named ravetxt2m.m

Examples: A simple function may look like:

x1 + cos(x2) * abs(x1/x2) - exp(x) + x^2

A more complicated function could be:


Function files created by Rave

Whenever you load a plain text function, Rave creates a .m function that it calls in place of the function you supplied. Rave does not use the original .txt file you supplied after the initial creation of this function. Any subsequent changes you make to the .txt file will have no effect in Rave. If you need to change the function you will have to directly modify the .m function.

Rave places the .m file it creates in your default directory. It's ok to move it to a different directory as long as you keep it on your MATLAB search path.