home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / octa21fb.zip / octave / doc / octave.i10 (.txt) < prev    next >
GNU Info File  |  2000-01-15  |  50KB  |  1,079 lines

  1. This is Info file octave, produced by Makeinfo-1.64 from the input file
  2. octave.tex.
  3. START-INFO-DIR-ENTRY
  4. * Octave: (octave).    Interactive language for numerical computations.
  5. END-INFO-DIR-ENTRY
  6.    Copyright (C) 1996, 1997 John W. Eaton.
  7.    Permission is granted to make and distribute verbatim copies of this
  8. manual provided the copyright notice and this permission notice are
  9. preserved on all copies.
  10.    Permission is granted to copy and distribute modified versions of
  11. this manual under the conditions for verbatim copying, provided that
  12. the entire resulting derived work is distributed under the terms of a
  13. permission notice identical to this one.
  14.    Permission is granted to copy and distribute translations of this
  15. manual into another language, under the above conditions for modified
  16. versions.
  17. File: octave,  Node: Signal Processing,  Next: Image Processing,  Prev: Control Theory,  Up: Top
  18. Signal Processing
  19. *****************
  20.    I hope that someday Octave will include more signal processing
  21. functions.  If you would like to help improve Octave in this area,
  22. please contact (bug-octave@bevo.che.wisc.edu).
  23.  - Function File:  detrend (X, P)
  24.      If X is a vector, `detrend (X, P)' removes the  best fit of a
  25.      polynomial of order P from the data X.
  26.      If X is a matrix, `detrend (X, P)' does the same  for each column
  27.      in X.
  28.      The second argument is optional.  If it is not specified, a value
  29.      of 1  is assumed.  This corresponds to removing a linear trend.
  30.  - Loadable Function:  fft (A, N)
  31.      Compute the FFT of A using subroutines from FFTPACK.  If A is a
  32.      matrix, `fft' computes the FFT for each column of A.
  33.      If called with two arguments, N is expected to be an integer
  34.      specifying the number of elements of A to use.  If A is a matrix,
  35.      N specifies the number of rows of A to use.  If N is larger than
  36.      the size of A, A is resized and padded with zeros.
  37.  - Loadable Function:  ifft (A, N)
  38.      Compute the inverse FFT of A using subroutines from FFTPACK.  If A
  39.      is a matrix, `fft' computes the inverse FFT for each column of A.
  40.      If called with two arguments, N is expected to be an integer
  41.      specifying the number of elements of A to use.  If A is a matrix,
  42.      N specifies the number of rows of A to use.  If N is larger than
  43.      the size of A, A is resized and padded with zeros.
  44.  - Loadable Function:  fft2 (A, N, M)
  45.      Compute the two dimensional FFT of A.
  46.      The optional arguments N and M may be used specify the number of
  47.      rows and columns of A to use.  If either of these is larger than
  48.      the size of A, A is resized and padded with zeros.
  49.  - Loadable Function:  ifft2 (A, N, M)
  50.      Compute the two dimensional inverse FFT of A.
  51.      The optional arguments N and M may be used specify the number of
  52.      rows and columns of A to use.  If either of these is larger than
  53.      the size of A, A is resized and padded with zeros.
  54.  - Function File:  fftconv (A, B, N)
  55.      Return the convolution of the vectors A and B, as a vector  with
  56.      length equal to the `length (a) + length (b) - 1'.  If A  and B
  57.      are the coefficient vectors of two polynomials, the returned
  58.      value is the coefficient vector of the product polynomial.
  59.      The computation uses the FFT by calling the function `fftfilt'.  If
  60.      the optional argument N is specified, an N-point FFT is used.
  61.  - Function File:  fftfilt (B, X, N)
  62.      With two arguments, `fftfilt' filters X with the FIR filter B
  63.      using the FFT.
  64.      Given the optional third argument, N, `fftfilt' uses the
  65.      overlap-add method to filter X with B using an N-point FFT.
  66.  - Loadable Function: y = filter (B, A, X)
  67.  - Loadable Function: [Y, SF] = filter (B, A, X, SI)
  68.      Return the solution to the following linear, time-invariant
  69.      difference equation:
  70.              N                   M
  71.             SUM a(k+1) y(n-k) = SUM b(k+1) x(n-k)      for 1<=n<=length(x)
  72.             k=0                 k=0
  73.      where  N=length(a)-1 and M=length(b)-1.  An equivalent form of
  74.      this equation is:
  75.                       N                   M
  76.             y(n) = - SUM c(k+1) y(n-k) + SUM d(k+1) x(n-k)  for 1<=n<=length(x)
  77.                      k=1                 k=0
  78.      where  c = a/a(1) and d = b/a(1).
  79.      If the fourth argument SI is provided, it is taken as the initial
  80.      state of the system and the final state is returned as SF.  The
  81.      state vector is a column vector whose length is equal to the
  82.      length of the longest coefficient vector minus one.  If SI is not
  83.      supplied, the initial state vector is set to all zeros.
  84.      In terms of the z-transform, y is the result of passing the
  85.      discrete- time signal x through a system characterized by the
  86.      following rational system function:
  87.                        M
  88.                       SUM d(k+1) z^(-k)
  89.                       k=0
  90.             H(z) = ----------------------
  91.                          N
  92.                     1 + SUM c(k+1) z(-k)
  93.                         k=1
  94.  - Function File: [H, W] = freqz (B, A, N, "whole")
  95.      Return the complex frequency response H of the rational IIR filter
  96.      whose numerator and denominator coefficients are B and A,
  97.      respectively.  The response is evaluated at N angular frequencies
  98.      between 0 and   2*pi.
  99.      The output value W is a vector of the frequencies.
  100.      If the fourth argument is omitted, the response is evaluated at
  101.      frequencies between 0 and   pi.
  102.      If N is omitted, a value of 512 is assumed.
  103.      If A is omitted, the denominator is assumed to be 1 (this
  104.      corresponds to a simple FIR filter).
  105.      For fastest computation, N should factor into a small number of
  106.      small primes.
  107.  - Function File:  sinc (X)
  108.      Return   sin(pi*x)/(pi*x).
  109.    % DO NOT EDIT!  Generated automatically by munge-texi.
  110. File: octave,  Node: Image Processing,  Next: Audio Processing,  Prev: Signal Processing,  Up: Top
  111. Image Processing
  112. ****************
  113.    Octave can display images with the X Window System using the
  114. `xloadimage' program.  You do not need to be running X in order to
  115. manipulate images, however, so some of these functions may be useful
  116. even if you are not able to view the results.
  117.    Loading images only works with Octave's image format (a file with a
  118. matrix containing the image data, and a matrix containing the
  119. colormap).  Contributions of robust, well-written functions to read
  120. other image formats are welcome.  If you can provide them, or would like
  121. to improve Octave's image processing capabilities in other ways, please
  122. contact (bug-octave@bevo.che.wisc.edu).
  123.  - Function File:  colormap (MAP)
  124.  - Function File:  colormap ("default")
  125.      Set the current colormap.
  126.      `colormap (MAP)' sets the current colormap to MAP.  The  color map
  127.      should be an N row by 3 column matrix.  The columns  contain red,
  128.      green, and blue intensities respectively.  All entries  should be
  129.      between 0 and 1 inclusive.  The new colormap is returned.
  130.      `colormap ("default")' restores the default colormap (a gray scale
  131.      colormap with 64 entries).  The default colormap is returned.
  132.      With no arguments, `colormap' returns the current color map.
  133.  - Function File:  gray (N)
  134.      Return a gray colormap with N entries corresponding to values from
  135.      0 to N-1.  The argument N should be a scalar.  If it is  omitted,
  136.      64 is assumed.
  137.  - Function File: [IMG, MAP] = gray2ind ()
  138.      Convert a gray scale intensity image to an Octave indexed image.
  139.  - Function File:  image (X, ZOOM)
  140.      Display a matrix as a color image.  The elements of X are indices
  141.      into the current colormap and should have values between 1 and the
  142.      length of the colormap.  If ZOOM is omitted, a value of 4 is
  143.      assumed.
  144.  - Function File:  imagesc (X, ZOOM)
  145.      Display a scaled version of the matrix X as a color image.  The
  146.      matrix is scaled so that its entries are indices into the current
  147.      colormap.  The scaled matrix is returned.  If ZOOM is omitted, a
  148.      value of 4 is assumed.
  149.  - Function File:  imshow (X, MAP)
  150.  - Function File:  imshow (X, N)
  151.  - Function File:  imshow (I, N)
  152.  - Function File:  imshow (R, G, B)
  153.      Display images.
  154.      `imshow (X)' displays an indexed image using the current  colormap.
  155.      `imshow (X, MAP)' displays an indexed image using the  specified
  156.      colormap.
  157.      `imshow (I, N)' displays a gray scale intensity image.
  158.      `imshow (R, G, B)' displays an RGB image.
  159.  - Function File:  ind2gray (X, MAP)
  160.      Convert an Octave indexed image to a gray scale intensity image.
  161.      If MAP is omitted, the current colormap is used to determine the
  162.      intensities.
  163.  - Function File: [R, G, B] = ind2rgb (X, MAP)
  164.      Convert an indexed image to red, green, and blue color components.
  165.      If MAP is omitted, the current colormap is used for the
  166.      conversion.
  167.  - Function File: [X, MAP] = loadimage (FILE)
  168.      Load an image file and it's associated color map from the specified
  169.      FILE.  The image must be stored in Octave's image format.
  170.  - Function File:  rgb2ntsc (RGB)
  171.      Image format conversion.
  172.  - Function File:  ntsc2rgb (YIQ)
  173.      Image format conversion.
  174.  - Function File:  ocean (N)
  175.      Create color colormap.  The argument N should be a scalar.  If it
  176.      is omitted, 64 is assumed.
  177.  - Function File: [X, MAP] = rgb2ind (R, G, B)
  178.      Convert and RGB image to an Octave indexed image.
  179.  - Function File:  saveimage (FILE, X, FMT, MAP)
  180.      Save the matrix X to FILE in image format FMT.  Valid  values for
  181.      FMT are
  182.     `"img"'
  183.           Octave's image format.  The current colormap is also saved in
  184.           the file.
  185.     `"ppm"'
  186.           Portable pixmap format.
  187.     `"ps"'
  188.           PostScript format.  Note that images saved in PostScript
  189.           format can not  be read back into Octave with loadimage.
  190.      If the fourth argument is supplied, the specified colormap will
  191.      also be  saved along with the image.
  192.      Note: if the colormap contains only two entries and these entries
  193.      are  black and white, the bitmap ppm and PostScript formats are
  194.      used.  If the  image is a gray scale image (the entries within
  195.      each row of the colormap  are equal) the gray scale ppm and
  196.      PostScript image formats are used,  otherwise the full color
  197.      formats are used.
  198.  - Built-in Variable: IMAGEPATH
  199.      A colon separated list of directories in which to search for image
  200.      files.
  201.    % DO NOT EDIT!  Generated automatically by munge-texi.
  202. File: octave,  Node: Audio Processing,  Next: System Utilities,  Prev: Image Processing,  Up: Top
  203. Audio Processing
  204. ****************
  205.    Octave provides a few functions for dealing with audio data.  An
  206. audio `sample' is a single output value from an A/D converter, i.e., a
  207. small integer number (usually 8 or 16 bits), and audio data is just a
  208. series of such samples.  It can be characterized by three parameters:
  209. the sampling rate (measured in samples per second or Hz, e.g. 8000 or
  210. 44100), the number of bits per sample (e.g. 8 or 16), and the number of
  211. channels (1 for mono, 2 for stereo, etc.).
  212.    There are many different formats for representing such data.
  213. Currently, only the two most popular, *linear encoding* and *mu-law
  214. encoding*, are supported by Octave.  There is an excellent FAQ on audio
  215. formats by Guido van Rossum <guido@cwi.nl> which can be found at any
  216. FAQ ftp site, in particular in the directory
  217. `/pub/usenet/news.answers/audio-fmts' of the archive site
  218. `rtfm.mit.edu'.
  219.    Octave simply treats audio data as vectors of samples (non-mono data
  220. are not supported yet).  It is assumed that audio files using linear
  221. encoding have one of the extensions `lin' or `raw', and that files
  222. holding data in mu-law encoding end in `au', `mu', or `snd'.
  223.  - Function File:  lin2mu (X)
  224.      If the vector X represents mono audio data in 8- or 16-bit  linear
  225.      encoding, `lin2mu (X)' is the corresponding mu-law  encoding.
  226.  - Function File:  mu2lin (X, BPS)
  227.      If the vector X represents mono audio data in mu-law encoding,
  228.      `mu2lin' converts it to linear encoding.  The optional argument
  229.      BPS specifies whether the input data uses 8 bit per sample
  230.      (default) or 16 bit.
  231.  - Function File:  loadaudio (NAME, EXT, BPS)
  232.      Loads audio data from the file `NAME.EXT' into the  vector X.
  233.      The extension EXT determines how the data in the audio file is
  234.      interpreted;  the extensions `lin' (default) and `raw'  correspond
  235.      to linear, the extensions `au', `mu', or `snd'  to mu-law encoding.
  236.      The argument BPS can be either 8 (default) or 16, and specifies
  237.      the number of bits per sample used in the audio file.
  238.  - Function File:  saveaudio (NAME, X, EXT, BPS)
  239.      Saves a vector X of audio data to the file `NAME.EXT'.  The
  240.      optional parameters EXT and BPS determine the encoding and the
  241.      number of bits per sample used  in the audio file (see
  242.      `loadaudio');  defaults are `lin' and  8, respectively.
  243.    The following functions for audio I/O require special A/D hardware
  244. and operating system support.  It is assumed that audio data in linear
  245. encoding can be played and recorded by reading from and writing to
  246. `/dev/dsp', and that similarly `/dev/audio' is used for mu-law
  247. encoding.  These file names are system-dependent.  Improvements so that
  248. these functions will work without modification on a wide variety of
  249. hardware are welcome.
  250.  - Function File:  playaudio (NAME, EXT)
  251.  - Function File:  playaudio (X)
  252.      Plays the audio file `NAME.EXT' or the audio data  stored in the
  253.      vector X.
  254.  - Function File:  record (SEC, SAMPLING_RATE)
  255.      Records SEC seconds of audio input into the vector X.  The
  256.      default value for SAMPLING_RATE is 8000 samples per second, or
  257.      8kHz.  The program waits until the user types RET and then
  258.      immediately starts to record.
  259.    usage: setaudio ([w_type [, value]])
  260.    executes the shell command `mixer [w_type [, value]]'
  261.    % DO NOT EDIT!  Generated automatically by munge-texi.
  262. File: octave,  Node: System Utilities,  Next: Tips,  Prev: Audio Processing,  Up: Top
  263. System Utilities
  264. ****************
  265.    This chapter describes the functions that are available to allow you
  266. to get information about what is happening outside of Octave, while it
  267. is still running, and use this information in your program.  For
  268. example, you can get information about environment variables, the
  269. current time, and even start other programs from the Octave prompt.
  270. * Menu:
  271. * Timing Utilities::
  272. * Filesystem Utilities::
  273. * Controlling Subprocesses::
  274. * Process ID Information::
  275. * Environment Variables::
  276. * Current Working Directory::
  277. * Password Database Functions::
  278. * Group Database Functions::
  279. * System Information::
  280. File: octave,  Node: Timing Utilities,  Next: Filesystem Utilities,  Prev: System Utilities,  Up: System Utilities
  281. Timing Utilities
  282. ================
  283.    Octave's core set of functions for manipulating time values are
  284. patterned after the corresponding functions from the standard C library.
  285. Several of these functions use a data structure for time that includes
  286. the following elements:
  287. `usec'
  288.      Microseconds after the second (0-999999).
  289. `sec'
  290.      Seconds after the minute (0-61).  This number can be 61 to account
  291.      for leap seconds.
  292. `min'
  293.      Minutes after the hour (0-59).
  294. `hour'
  295.      Hours since midnight (0-23).
  296. `mday'
  297.      Day of the month (1-31).
  298. `mon'
  299.      Months since January (0-11).
  300. `year'
  301.      Years since 1900.
  302. `wday'
  303.      Days since Sunday (0-6).
  304. `yday'
  305.      Days since January 1 (0-365).
  306. `isdst'
  307.      Daylight Savings Time flag.
  308. `zone'
  309.      Time zone.
  310. In the descriptions of the following functions, this structure is
  311. referred to as a TM_STRUCT.
  312.  - Loadable Function:  time ()
  313.      Return the current time as the number of seconds since the epoch.
  314.      The epoch is referenced to 00:00:00 CUT (Coordinated Universal
  315.      Time) 1 Jan 1970.  For example, on Monday February 17, 1997 at
  316.      07:15:06 CUT, the value returned by `time' was 856163706.
  317.  - Function File:  ctime (T)
  318.      Convert a value returned from `time' (or any other nonnegative
  319.      integer), to the local time and return a string of the same form as
  320.      `asctime'.  The function `ctime (time)' is equivalent to `asctime
  321.      (localtime (time))'.  For example,
  322.            ctime (time ())
  323.           => "Mon Feb 17 01:15:06 1997"
  324.  - Loadable Function:  gmtime (T)
  325.      Given a value returned from time (or any nonnegative integer),
  326.      return a time structure corresponding to CUT.  For example,
  327.           gmtime (time ())
  328.                => {
  329.                      usec = 0
  330.                      year = 97
  331.                      mon = 1
  332.                      mday = 17
  333.                      sec = 6
  334.                      zone = CST
  335.                      min = 15
  336.                      wday = 1
  337.                      hour = 7
  338.                      isdst = 0
  339.                      yday = 47
  340.                    }
  341.  - Loadable Function:  localtime (T)
  342.      Given a value returned from time (or any nonnegative integer),
  343.      return a time structure corresponding to the local time zone.
  344.           localtime (time ())
  345.                => {
  346.                      usec = 0
  347.                      year = 97
  348.                      mon = 1
  349.                      mday = 17
  350.                      sec = 6
  351.                      zone = CST
  352.                      min = 15
  353.                      wday = 1
  354.                      hour = 1
  355.                      isdst = 0
  356.                      yday = 47
  357.                    }
  358.  - Loadable Function:  mktime (TM_STRUCT)
  359.      Convert a time structure corresponding to the local time to the
  360.      number of seconds since the epoch.  For example,
  361.           mktime (localtime (time ())
  362.                => 856163706
  363.  - Function File:  asctime (TM_STRUCT)
  364.      Convert a time structure to a string using the following five-field
  365.      format: Thu Mar 28 08:40:14 1996.  For example,
  366.            asctime (localtime (time ())
  367.           => "Mon Feb 17 01:15:06 1997\n"
  368.      This is equivalent to `ctime (time ())'.
  369.  - Loadable Function:  strftime (TM_STRUCT)
  370.      Format a time structure in a flexible way using `%' substitutions
  371.      similar to those in `printf'.  Except where noted, substituted
  372.      fields have a fixed size; numeric fields are padded if necessary.
  373.      Padding is with zeros by default; for fields that display a single
  374.      number, padding can be changed or inhibited by following the `%'
  375.      with one of the modifiers described below.  Unknown field
  376.      specifiers are copied as normal characters.  All other characters
  377.      are copied to the output without change.  For example,
  378.           strftime ("%r (%Z) %A %e %B %Y", localtime (time ())
  379.                => "01:15:06 AM (CST) Monday 17 February 1997"
  380.      Octave's `strftime' function supports a superset of the ANSI C
  381.      field specifiers.
  382.      Literal character fields:
  383.     `%'
  384.           % character.
  385.     `n'
  386.           Newline character.
  387.     `t'
  388.           Tab character.
  389.      Numeric modifiers (a nonstandard extension):
  390.     `- (dash)'
  391.           Do not pad the field.
  392.     `_ (underscore)'
  393.           Pad the field with spaces.
  394.      Time fields:
  395.     `%H'
  396.           Hour (00-23).
  397.     `%I'
  398.           Hour (01-12).
  399.     `%k'
  400.           Hour (0-23).
  401.     `%l'
  402.           Hour (1-12).
  403.     `%M'
  404.           Minute (00-59).
  405.     `%p'
  406.           Locale's AM or PM.
  407.     `%r'
  408.           Time, 12-hour (hh:mm:ss [AP]M).
  409.     `%R'
  410.           Time, 24-hour (hh:mm).
  411.     `%s'
  412.           Time in seconds since 00:00:00, Jan 1, 1970 (a nonstandard
  413.           extension).
  414.     `%S'
  415.           Second (00-61).
  416.     `%T'
  417.           Time, 24-hour (hh:mm:ss).
  418.     `%X'
  419.           Locale's time representation (%H:%M:%S).
  420.     `%Z'
  421.           Time zone (EDT), or nothing if no time zone is determinable.
  422.      Date fields:
  423.     `%a'
  424.           Locale's abbreviated weekday name (Sun-Sat).
  425.     `%A'
  426.           Locale's full weekday name, variable length (Sunday-Saturday).
  427.     `%b'
  428.           Locale's abbreviated month name (Jan-Dec).
  429.     `%B'
  430.           Locale's full month name, variable length (January-December).
  431.     `%c'
  432.           Locale's date and time (Sat Nov 04 12:02:33 EST 1989).
  433.     `%C'
  434.           Century (00-99).
  435.     `%d'
  436.           Day of month (01-31).
  437.     `%e'
  438.           Day of month ( 1-31).
  439.     `%D'
  440.           Date (mm/dd/yy).
  441.     `%h'
  442.           Same as %b.
  443.     `%j'
  444.           Day of year (001-366).
  445.     `%m'
  446.           Month (01-12).
  447.     `%U'
  448.           Week number of year with Sunday as first day of week (00-53).
  449.     `%w'
  450.           Day of week (0-6).
  451.     `%W'
  452.           Week number of year with Monday as first day of week (00-53).
  453.     `%x'
  454.           Locale's date representation (mm/dd/yy).
  455.     `%y'
  456.           Last two digits of year (00-99).
  457.     `%Y'
  458.           Year (1970-).
  459.    Most of the remaining functions described in this section are not
  460. patterned after the standard C library.  Some are available for
  461. compatiblity with MATLAB and others are provided because they are
  462. useful.
  463.  - Function File:  clock ()
  464.      Return a vector containing the current year, month (1-12), day
  465.      (1-31),  hour (0-23), minute (0-59) and second (0-61).  For
  466.      example,
  467.            clock ()
  468.           => [ 1993, 8, 20, 4, 56, 1 ]
  469.      The function clock is more accurate on systems that have the
  470.      `gettimeofday' function.
  471.  - Function File:  date ()
  472.      Return the date as a character string in the form DD-MMM-YY.  For
  473.      example,
  474.            date ()
  475.           => "20-Aug-93"
  476.  - Function File:  etime (T1, T2)
  477.      Return the difference (in seconds) between two time values
  478.      returned from `clock'.  For example:
  479.            t0 = clock ();
  480.            # many computations later...
  481.            elapsed_time = etime (clock (), t0);
  482.      will set the variable `elapsed_time' to the number of seconds since
  483.      the variable `t0' was set.
  484.  - Function File: [TOTAL, USER, SYSTEM] = cputime ();
  485.      Return the CPU time used by your Octave session.  The first output
  486.      is  the total time spent executing your process and is equal to
  487.      the sum of  second and third outputs, which are the number of CPU
  488.      seconds spent  executing in user mode and the number of CPU
  489.      seconds spent executing in  system mode, respectively.  If your
  490.      system does not have a way to report  CPU time usage, `cputime'
  491.      returns 0 for each of its output values.   Note that because
  492.      Octave used some CPU time to start, it is reasonable  to check to
  493.      see if `cputime' works by checking to see if the total  CPU time
  494.      used is nonzero.
  495.  - Function File:  is_leap_year (YEAR)
  496.      Return 1 if the given year is a leap year and 0 otherwise.  If no
  497.      arguments are provided, `is_leap_year' will use the current year.
  498.      For example,
  499.            is_leap_year (2000)
  500.           => 1
  501.  - Function File:  tic ()
  502.  - Function File:  toc ()
  503.      These functions set and check a wall-clock timer.  For example,
  504.            tic ();
  505.            # many computations later...
  506.            elapsed_time = toc ();
  507.      will set the variable `elapsed_time' to the number of seconds since
  508.      the most recent call to the function `tic'.
  509.      If you are more interested in the CPU time that your process used,
  510.      you  should use the `cputime' function instead.  The `tic' and
  511.      `toc' functions report the actual wall clock time that elapsed
  512.      between the calls.  This may include time spent processing other
  513.      jobs or  doing nothing at all.  For example,
  514.            tic (); sleep (5); toc ()
  515.           => 5
  516.            t = cputime (); sleep (5); cputime () - t
  517.           => 0
  518.      (This example also illustrates that the CPU timer may have a fairly
  519.      coarse resolution.)
  520.  - Built-in Function:  pause (SECONDS)
  521.      Suspend the execution of the program.  If invoked without any
  522.      arguments, Octave waits until you type a character.  With a
  523.      numeric argument, it pauses for the given number of seconds.  For
  524.      example, the following statement prints a message and then waits 5
  525.      seconds before clearing the screen.
  526.           fprintf (stderr, "wait please...
  527.           ");
  528.           pause (5);
  529.           clc;
  530.  - Built-in Function:  sleep (SECONDS)
  531.      Suspend the execution of the program for the given number of
  532.      seconds.
  533.  - Built-in Function:  usleep (MICROSECONDS)
  534.      Suspend the execution of the program for the given number of
  535.      microseconds.  On systems where it is not possible to sleep for
  536.      periods of time less than one second, `usleep' will pause the
  537.      execution for `round (MICROSECONDS / 1e6)' seconds.
  538. File: octave,  Node: Filesystem Utilities,  Next: Controlling Subprocesses,  Prev: Timing Utilities,  Up: System Utilities
  539. Filesystem Utilities
  540. ====================
  541.    Octave includes the following functions for renaming and deleting
  542. files, creating, deleting, and reading directories, and for getting
  543. information about the status of files.
  544.  - Built-in Function: [ERR, MSG] = rename (OLD, NEW)
  545.      Change the name of file OLD to NEW.
  546.      If successful, ERR is 0 and MSG is an empty string.  Otherwise,
  547.      ERR is nonzero and MSG contains a system-dependent error message.
  548.  - Built-in Function: [ERR, MSG] = unlink (FILE)
  549.      Delete the file named FILE.
  550.      If successful, ERR is 0 and MSG is an empty string.  Otherwise,
  551.      ERR is nonzero and MSG contains a system-dependent error message.
  552.  - Built-in Function: [FILES, ERR, MSG] = readdir (DIR)
  553.      Return names of the files in the directory DIR as an array of
  554.      strings.  If an error occurs, return an empty matrix in FILES.
  555.      If successful, ERR is 0 and MSG is an empty string.  Otherwise,
  556.      ERR is nonzero and MSG contains a system-dependent error message.
  557.  - Built-in Function: [ERR, MSG] = mkdir (DIR)\nCreate a directory
  558.           named DIR.
  559.      If successful, ERR is 0 and MSG is an empty string.  Otherwise,
  560.      ERR is nonzero and MSG contains a system-dependent error message.
  561.  - Built-in Function: [ERR, MSG] = rmdir (DIR)
  562.      Remove the directory named DIR.
  563.      If successful, ERR is 0 and MSG is an empty string.  Otherwise,
  564.      ERR is nonzero and MSG contains a system-dependent error message.
  565.  - Built-in Function: [ERR, MSG] = mkfifo (NAME)
  566.      Create a FIFO special file named NAME with file mode MODE \n If
  567.      successful, ERR is 0 and MSG is an empty string.  Otherwise, ERR
  568.      is nonzero and MSG contains a system-dependent error message.
  569.  - Built-in Function:  umask (MASK)
  570.      Set the permission mask for file creation.  The parameter MASK  is
  571.      an integer, interpreted as an octal number.  If successful,
  572.      returns the previous value of the mask (as an integer to be
  573.      interpreted as an octal number); otherwise an error message is
  574.      printed.
  575.  - Built-in Function: [INFO, ERR, MSG] = stat (FILE)
  576.  - Built-in Function: [INFO, ERR, MSG] = lstat (FILE)
  577.      Return a structure S containing the following information about
  578.      FILE.
  579.     `dev'
  580.           ID of device containing a directory entry for this file.
  581.     `ino'
  582.           File number of the file.
  583.     `modestr'
  584.           File mode, as a string of ten letters or dashes as would be
  585.           returned by `ls -l'.
  586.     `nlink'
  587.           Number of links.
  588.     `uid'
  589.           User ID of file's owner.
  590.     `gid'
  591.           Group ID of file's group.
  592.     `rdev'
  593.           ID of device for block or character special files.
  594.     `size'
  595.           Size in bytes.
  596.     `atime'
  597.           Time of last access in the same form as time values returned
  598.           from `time'.  *Note Timing Utilities::.
  599.     `mtime'
  600.           Time of last modification in the same form as time values
  601.           returned from `time'.  *Note Timing Utilities::.
  602.     `ctime'
  603.           Time of last file status change in the same form as time
  604.           values returned from `time'.  *Note Timing Utilities::.
  605.     `blksize'
  606.           Size of blocks in the file.
  607.     `blocks'
  608.           Number of blocks allocated for file.
  609.      If the call is successful ERR is 0 and MSG is an empty string.  If
  610.      the file does not exist, or some other error occurs, S is an empty
  611.      matrix, ERR is -1, and MSG contains the corresponding system error
  612.      message.
  613.      If FILE is a symbolic link, `stat' will return information about
  614.      the actual file the is referenced by the link.  Use `lstat' if you
  615.      want information about the symbolic link itself.
  616.      For example,
  617.           [s, err, msg] = stat ("/vmlinuz")
  618.                 => s =
  619.                   {
  620.                     atime = 855399756
  621.                     rdev = 0
  622.                     ctime = 847219094
  623.                     uid = 0
  624.                     size = 389218
  625.                     blksize = 4096
  626.                     mtime = 847219094
  627.                     gid = 6
  628.                     nlink = 1
  629.                     blocks = 768
  630.                     modestr = -rw-r--r--
  631.                     ino = 9316
  632.                     dev = 2049
  633.                   }
  634.                => err = 0
  635.                => msg =
  636.  - Built-in Function:  glob (PATTERN)
  637.      Given an array of strings in PATTERN, return the list of file
  638.      names that any of them, or an empty string if no patterns match.
  639.      Tilde expansion is performed on each of the patterns before
  640.      looking for matching file names.  For example,
  641.           glob ("/vm*")
  642.                => "/vmlinuz"
  643.      Note that multiple values are returned in a string matrix with the
  644.      fill character set to ASCII NUL.
  645.  - Built-in Function:  file_in_path (PATH, FILE)
  646.      Return the absolute name name of FILE if it can be found in PATH.
  647.      The value of PATH should be a colon-separated list of directories
  648.      in the format described for the built-in variable `LOADPATH'.
  649.      If the file cannot be found in the path, an empty matrix is
  650.      returned.  For example,
  651.           file_in_path (LOADPATH, "nargchk.m")
  652.                => "/share/octave/2.0/m/general/nargchk.m"
  653.  - Built-in Function:  tilde_expand (STRING)
  654.      Performs tilde expansion on STRING.  If STRING begins with a tilde
  655.      character, (`~'), all of the characters preceding the first slash
  656.      (or all characters, if there is no slash) are treated as a
  657.      possible user name, and the tilde and the following characters up
  658.      to the slash are replaced by the home directory of the named user.
  659.      If the tilde is followed immediately by a slash, the tilde is
  660.      replaced by the home directory of the user running Octave.  For
  661.      example,
  662.           tilde_expand ("~joeuser/bin")
  663.                => "/home/joeuser/bin"
  664.           tilde_expand ("~/bin")
  665.                => "/home/jwe/bin"
  666. File: octave,  Node: Controlling Subprocesses,  Next: Process ID Information,  Prev: Filesystem Utilities,  Up: System Utilities
  667. Controlling Subprocesses
  668. ========================
  669.    Octave includes some high-level commands like `system' and `popen'
  670. for starting subprocesses.  If you want to run another program to
  671. perform some task and then look at its output, you will probably want
  672. to use these functions.
  673.    Octave also provides several very low-level Unix-like functions which
  674. can also be used for starting subprocesses, but you should probably only
  675. use them if you can't find any way to do what you need with the
  676. higher-level functions.
  677.  - Built-in Function:  system (STRING, RETURN_OUTPUT, TYPE)
  678.      Execute a shell command specified by STRING.  The second argument
  679.      is optional.  If TYPE is `"async"', the process is started in the
  680.      background and the process id of the child process is returned
  681.      immediately.  Otherwise, the process is started, and Octave waits
  682.      until it exits.  If TYPE argument is omitted, a value of `"sync"'
  683.      is assumed.
  684.      If two input arguments are given (the actual value of
  685.      RETURN_OUTPUT is irrelevant) and the subprocess is started
  686.      synchronously, or if SYSTEM is called with one input argument and
  687.      one or more output arguments, the output from the command is
  688.      returned.  Otherwise, if the subprocess is executed synchronously,
  689.      it's output is sent to the standard output.  To send the output of
  690.      a command executed with SYSTEM through the pager, use a command
  691.      like
  692.           disp (system (cmd, 1));
  693.      or
  694.           printf ("%s
  695.           ", system (cmd, 1));
  696.      The `system' function can return two values.  The first is any
  697.      output from the command that was written to the standard output
  698.      stream, and the second is the output status of the command.  For
  699.      example,
  700.           [output, status] = system ("echo foo; exit 2");
  701.      will set the variable `output' to the string `foo', and the
  702.      variable `status' to the integer `2'.
  703.  - Built-in Function: fid = popen (COMMAND, MODE)
  704.      Start a process and create a pipe.  The name of the command to run
  705.      is given by COMMAND.  The file identifier corresponding to the
  706.      input or output stream of the process is returned in FID.  The
  707.      argument MODE may be
  708.     `"r"'
  709.           The pipe will be connected to the standard output of the
  710.           process, and open for reading.
  711.     `"w"'
  712.           The pipe will be connected to the standard input of the
  713.           process, and open for writing.
  714.      For example,
  715.           fid = popen ("ls -ltr / | tail -3", "r");
  716.           while (isstr (s = fgets (fid)))
  717.             fputs (stdout, s);
  718.           endwhile
  719.                -| drwxr-xr-x  33 root  root  3072 Feb 15 13:28 etc
  720.                -| drwxr-xr-x   3 root  root  1024 Feb 15 13:28 lib
  721.                -| drwxrwxrwt  15 root  root  2048 Feb 17 14:53 tmp
  722.  - Built-in Function:  pclose (FID)
  723.      Close a file identifier that was opened by `popen'.  You may also
  724.      use `fclose' for the same purpose.
  725.  - Function File: [IN, OUT, PID] = popen2 (COMMAND, ARGS)
  726.      Start a subprocess with two-way communication.  The name of the
  727.      process  is given by COMMAND, and ARGS is an array of strings
  728.      containing options for the command.  The file identifiers for the
  729.      input  and output streams of the subprocess are returned in IN and
  730.      OUT.  If execution of the command is successful, PID  contains the
  731.      process ID of the subprocess.  Otherwise, PID is -1.
  732.      For example,
  733.            [in, out, pid] = popen2 ("sort", "-nr");
  734.            fputs (in, "these\nare\nsome\nstrings\n");
  735.            fclose (in);
  736.            while (isstr (s = fgets (out)))
  737.              fputs (stdout, s);
  738.            endwhile
  739.            fclose (out);
  740.           -| are
  741.           -| some
  742.           -| strings
  743.           -| these
  744.  - Built-in Variable: EXEC_PATH
  745.      The variable `EXEC_PATH' is a colon separated list of directories
  746.      to search when executing subprograms.  Its initial value is taken
  747.      from the environment variable `OCTAVE_EXEC_PATH' (if it exists) or
  748.      `PATH', but that value can be overridden by the command line
  749.      argument `--exec-path PATH', or by setting the value of
  750.      `EXEC_PATH' in a startup script.  If the value of `EXEC_PATH'
  751.      begins (ends) with a colon, the directories
  752.           OCTAVE-HOME/libexec/octave/site/exec/ARCH
  753.           OCTAVE-HOME/libexec/octave/VERSION/exec/ARCH
  754.      are prepended (appended) to `EXEC_PATH', where OCTAVE-HOME is the
  755.      top-level directory where all of Octave is installed (the default
  756.      value is `').  If you don't specify a value for `EXEC_PATH'
  757.      explicitly, these special directories are prepended to your shell
  758.      path.
  759.    In most cases, the following functions simply decode their arguments
  760. and make the corresponding Unix system calls.  For a complete example
  761. of how they can be used, look at the definition of the function
  762. `popen2'.
  763.  - Built-in Function: [PID, MSG] = fork ()
  764.      Create a copy of the current process.
  765.      Fork can return one of the following values:
  766.     > 0
  767.           You are in the parent process.  The value returned from
  768.           `fork' is the process id of the child process.  You should
  769.           probably arrange to wait for any child processes to exit.
  770.     0
  771.           You are in the child process.  You can call `exec' to start
  772.           another process.  If that fails, you should probably call
  773.           `exit'.
  774.     < 0
  775.           The call to `fork' failed for some reason.  You must take
  776.           evasive action.  A system dependent error message will be
  777.           waiting in MSG.
  778.  - Built-in Function: [ERR, MSG] = exec (FILE, ARGS)
  779.      Replace current process with a new process.  Calling `exec' without
  780.      first calling `fork' will terminate your current Octave process and
  781.      replace it with the program named by FILE.  For example,
  782.           exec ("ls" "-l")
  783.      will run `ls' and return you to your shell prompt.
  784.      If successful, `exec' does not return.  If `exec' does return, ERR
  785.      will be nonzero, and MSG will contain a system-dependent error
  786.      message.
  787.  - Built-in Function: [FILE_IDS, ERR, MSG] = pipe ()
  788.      Create a pipe and return the vector FILE_IDS, which corresponding
  789.      to the reading and writing ends of the pipe.
  790.      If successful, ERR is 0 and MSG is an empty string.  Otherwise,
  791.      ERR is nonzero and MSG contains a system-dependent error message.
  792.  - Built-in Function: [FID, MSG] = dup2 (OLD, NEW)
  793.      Duplicate a file descriptor.
  794.      If successful, FID is greater than zero and contains the new file
  795.      ID.  Otherwise, FID is negative and MSG contains a
  796.      system-dependent error message.
  797.  - Built-in Function: [PID, MSG] = waitpid (PID, OPTIONS)
  798.      Wait for process PID to terminate.  The PID argument can be:
  799.     -1
  800.           Wait for any child process.
  801.     0
  802.           Wait for any child process whose process group ID is equal to
  803.           that of the Octave interpreter process.
  804.     > 0
  805.           Wait for termination of the child process with ID PID.
  806.      The OPTIONS argument can be:
  807.     0
  808.           Wait until signal is received or a child process exits (this
  809.           is the default if the OPTIONS argument is missing).
  810.     1
  811.           Do not hang if status is not immediately available.
  812.     2
  813.           Report the status of any child processes that are stopped,
  814.           and whose status has not yet been reported since they stopped.
  815.     3
  816.           Implies both 1 and 2.
  817.      If the returned value of PID is greater than 0, it is the process
  818.      ID of the child process that exited.  If an error occurs, PID will
  819.      be less than zero and MSG will contain a system-dependent error
  820.      message.
  821.  - Built-in Function: [ERR, MSG] = fcntl (FID, REQUEST, ARG)
  822.      Change the properties of the open file FID.  The following values
  823.      may be passed as REQUEST:
  824.     `F_DUPFD'
  825.           Return a duplicate file descriptor.
  826.     `F_GETFD'
  827.           Return the file descriptor flags for FID.
  828.     `F_SETFD'
  829.           Set the file descriptor flags for FID.
  830.     `F_GETFL'
  831.           Return the file status flags for FID.  The following codes
  832.           may be returned (some of the flags may be undefined on some
  833.           systems).
  834.          `O_RDONLY'
  835.                Open for reading only.
  836.          `O_WRONLY'
  837.                Open for writing only.
  838.          `O_RDWR'
  839.                Open for reading and writing.
  840.          `O_APPEND'
  841.                Append on each write.
  842.          `O_NONBLOCK'
  843.                Nonblocking mode.
  844.          `O_SYNC'
  845.                Wait for writes to complete.
  846.          `O_ASYNC'
  847.                Asynchronous I/O.
  848.     `F_SETFL'
  849.           Set the file status flags for FID to the value specified by
  850.           ARG.  The only flags that can be changed are `O_APPEND' and
  851.           `O_NONBLOCK'.
  852.      If successful, ERR is 0 and MSG is an empty string.  Otherwise,
  853.      ERR is nonzero and MSG contains a system-dependent error message.
  854. File: octave,  Node: Process ID Information,  Next: Environment Variables,  Prev: Controlling Subprocesses,  Up: System Utilities
  855. Process, Group, and User IDs
  856. ============================
  857.  - Built-in Function: pgid = getpgrp ()
  858.      Return the process group id of the current process.
  859.  - Built-in Function: pid = getpid ()
  860.      Return the process id of the current process.
  861.  - Built-in Function: pid = getppid ()
  862.      Return the process id of the parent process.
  863.  - Built-in Function: euid = geteuid ()
  864.      Return the effective user id of the current process.
  865.  - Built-in Function: uid = getuid ()
  866.      Return the real user id of the current process.
  867.  - Built-in Function: egid = getegid ()
  868.      Return the effective group id of the current process.
  869.  - Built-in Function: gid = getgid ()
  870.      Return the real group id of the current process.
  871. File: octave,  Node: Environment Variables,  Next: Current Working Directory,  Prev: Process ID Information,  Up: System Utilities
  872. Environment Variables
  873. =====================
  874.  - Built-in Function:  getenv (VAR)
  875.      Return the value of the environment variable VAR.  For example,
  876.           getenv ("PATH")
  877.      returns a string containing the value of your path.
  878.  - Built-in Function:  putenv (VAR, VALUE)
  879.      Set the value of the environment variable VAR to VALUE.
  880. File: octave,  Node: Current Working Directory,  Next: Password Database Functions,  Prev: Environment Variables,  Up: System Utilities
  881. Current Working Directory
  882. =========================
  883.  - Command: cd DIR
  884.  - Command: chdir DIR
  885.      Change the current working directory to DIR.  If DIR is omitted,
  886.      the current directory is changed to the users home directory.  For
  887.      example,
  888.           cd ~/octave
  889.      Changes the current working directory to `~/octave'.  If the
  890.      directory does not exist, an error message is printed and the
  891.      working directory is not changed.
  892.  - Command: ls OPTIONS
  893.  - Command: dir OPTIONS
  894.      List directory contents.  For example,
  895.           ls -l
  896.                -| total 12
  897.                -| -rw-r--r--   1 jwe  users  4488 Aug 19 04:02 foo.m
  898.                -| -rw-r--r--   1 jwe  users  1315 Aug 17 23:14 bar.m
  899.      The `dir' and `ls' commands are implemented by calling your
  900.      system's directory listing command, so the available options may
  901.      vary from system to system.
  902.  - Built-in Function:  pwd ()
  903.      Return the current working directory.
  904. File: octave,  Node: Password Database Functions,  Next: Group Database Functions,  Prev: Current Working Directory,  Up: System Utilities
  905. Password Database Functions
  906. ===========================
  907.    Octave's password database functions return information in a
  908. structure with the following fields.
  909. `name'
  910.      The user name.
  911. `passwd'
  912.      The encrypted password, if available.
  913. `uid'
  914.      The numeric user id.
  915. `gid'
  916.      The numeric group id.
  917. `gecos'
  918.      The GECOS field.
  919. `dir'
  920.      The home directory.
  921. `shell'
  922.      The initial shell.
  923.    In the descriptions of the following functions, this data structure
  924. is referred to as a PW_STRUCT.
  925.  - Loadable Function: PW_STRUCT =  getpwent ()
  926.      Return a structure containing an entry from the password database,
  927.      opening it if necessary. Once the end of the data has been reached,
  928.      `getpwent' returns 0.
  929.  - Loadable Function: PW_STRUCT =  getpwuid (UID).
  930.      Return a structure containing the first entry from the password
  931.      database with the user ID UID.  If the user ID does not exist in
  932.      the database, `getpwuid' returns 0.
  933.  - Loadable Function: PW_STRUCT =  getpwnam (NAME)
  934.      Return a structure containing the first entry from the password
  935.      database with the user name NAME.  If the user name does not exist
  936.      in the database, `getpwname' returns 0.
  937.  - Loadable Function:  setpwent ()
  938.      Return the internal pointer to the beginning of the password
  939.      database.
  940.  - Loadable Function:  endpwent ()
  941.      Close the password database.
  942. File: octave,  Node: Group Database Functions,  Next: System Information,  Prev: Password Database Functions,  Up: System Utilities
  943. Group Database Functions
  944. ========================
  945.    Octave's group database functions return information in a structure
  946. with the following fields.
  947. `name'
  948.      The user name.
  949. `passwd'
  950.      The encrypted password, if available.
  951. `gid'
  952.      The numeric group id.
  953. `mem'
  954.      The members of the group.
  955.    In the descriptions of the following functions, this data structure
  956. is referred to as a GRP_STRUCT.
  957.  - Loadable Function: GRP_STRUCT = getgrent ()
  958.      Return an entry from the group database, opening it if necessary.
  959.      Once the end of the data has been reached, `getgrent' returns 0.
  960.  - Loadable Function: GRP_STRUCT = getgrgid (GID).
  961.      Return the first entry from the group database with the group ID
  962.      GID.  If the group ID does not exist in the database, `getgrgid'
  963.      returns 0.
  964.  - Loadable Function: GRP_STRUCT = getgrnam (NAME)
  965.      Return the first entry from the group database with the group name
  966.      NAME.  If the group name does not exist in the database,
  967.      `getgrname' returns 0.
  968.  - Loadable Function:  setgrent ()
  969.      Return the internal pointer to the beginning of the group database.
  970.  - Loadable Function:  endgrent ()
  971.      Close the group database.
  972. File: octave,  Node: System Information,  Prev: Group Database Functions,  Up: System Utilities
  973. System Information
  974. ==================
  975.  - Built-in Function:  computer ()
  976.      Print or return a string of the form CPU-VENDOR-OS that identifies
  977.      the kind of computer Octave is running on.  If invoked with an
  978.      output argument, the value is returned instead of printed.  For
  979.      example,
  980.           computer ()
  981.                -| i586-pc-linux-gnu
  982.           
  983.           x = computer ()
  984.                => x = "i586-pc-linux-gnu"
  985.  - Built-in Function:  isieee ()
  986.      Return 1 if your computer claims to conform to the IEEE standard
  987.      for floating point calculations.
  988.  - Built-in Variable: OCTAVE_VERSION
  989.      The version number of Octave, as a string.
  990.  - Built-in Function:  octave_config_info (OPTION)
  991.      Return a structure containing configuration and installation
  992.      information for Octave.
  993.      if OPTION is a string, return the configuration information for the
  994.      specified option.
  995.  - Loadable Function:  getrusage ()
  996.      Return a structure containing a number of statistics about the
  997.      current Octave process.  Not all fields are available on all
  998.      systems.  If it is not possible to get CPU time statistics, the
  999.      CPU time slots are set to zero.  Other missing data are replaced
  1000.      by NaN.  Here is a list of all the possible fields that can be
  1001.      present in the structure returned by `getrusage':
  1002.     `idrss'
  1003.           Unshared data size.
  1004.     `inblock'
  1005.           Number of block input operations.
  1006.     `isrss'
  1007.           Unshared stack size.
  1008.     `ixrss'
  1009.           Shared memory size.
  1010.     `majflt'
  1011.           Number of major page faults.
  1012.     `maxrss'
  1013.           Maximum data size.
  1014.     `minflt'
  1015.           Number of minor page faults.
  1016.     `msgrcv'
  1017.           Number of messages received.
  1018.     `msgsnd'
  1019.           Number of messages sent.
  1020.     `nivcsw'
  1021.           Number of involuntary context switches.
  1022.     `nsignals'
  1023.           Number of signals received.
  1024.     `nswap'
  1025.           Number of swaps.
  1026.     `nvcsw'
  1027.           Number of voluntary context switches.
  1028.     `oublock'
  1029.           Number of block output operations.
  1030.     `stime'
  1031.           A structure containing the system CPU time used.  The
  1032.           structure has the elements `sec' (seconds) `usec'
  1033.           (microseconds).
  1034.     `utime'
  1035.           A structure containing the user CPU time used.  The structure
  1036.           has the elements `sec' (seconds) `usec' (microseconds).
  1037.    % DO NOT EDIT!  Generated automatically by munge-texi.
  1038. File: octave,  Node: Tips,  Next: Trouble,  Prev: System Utilities,  Up: Top
  1039. Tips and Standards
  1040. ******************
  1041.    This chapter describes no additional features of Octave.  Instead it
  1042. gives advice on making effective use of the features described in the
  1043. previous chapters.
  1044. * Menu:
  1045. * Style Tips::                  Writing clean and robust programs.
  1046. * Coding Tips::                 Making code run faster.
  1047. * Documentation Tips::          Writing readable documentation strings.
  1048. * Comment Tips::                Conventions for writing comments.
  1049. * Function Headers::            Standard headers for functions.
  1050. File: octave,  Node: Style Tips,  Next: Coding Tips,  Prev: Tips,  Up: Tips
  1051. Writing Clean Octave Programs
  1052. =============================
  1053.    Here are some tips for avoiding common errors in writing Octave code
  1054. intended for widespread use:
  1055.    * Since all global variables share the same name space, and all
  1056.      functions share another name space, you should choose a short word
  1057.      to distinguish your program from other Octave programs.  Then take
  1058.      care to begin the names of all global variables, constants, and
  1059.      functions with the chosen prefix.  This helps avoid name conflicts.
  1060.      If you write a function that you think ought to be added to Octave
  1061.      under a certain name, such as `fiddle_matrix', don't call it by
  1062.      that name in your program.  Call it `mylib_fiddle_matrix' in your
  1063.      program, and send mail to (bug-octave@bevo.che.wisc.edu)
  1064.      suggesting that it be added to Octave.  If and when it is, the
  1065.      name can be changed easily enough.
  1066.      If one prefix is insufficient, your package may use two or three
  1067.      alternative common prefixes, so long as they make sense.
  1068.      Separate the prefix from the rest of the symbol name with an
  1069.      underscore `_'.  This will be consistent with Octave itself and
  1070.      with most Octave programs.
  1071.    * When you encounter an error condition, call the function `error'
  1072.      (or `usage').  The `error' and `usage' functions do not return.
  1073.      *Note Errors::.
  1074.    * Please put a copyright notice on the file if you give copies to
  1075.      anyone.  Use the same lines that appear at the top of the function
  1076.      files distributed with Octave.  If you have not signed papers to
  1077.      assign the copyright to anyone else, then place your name in the
  1078.      copyright notice.
  1079.