Mercurial > hg > octave-avbm
changeset 2303:5cffc4b8de57
[project @ 1996-06-24 09:15:24 by jwe]
line wrap: on
line diff
--- a/scripts/audio/lin2mu.m +++ b/scripts/audio/lin2mu.m @@ -1,12 +1,31 @@ +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. + function y = lin2mu (x) -# usage: y = lin2mu (x) -# -# x is a vector of an 8- or 16-bit linearly encoded audio sample, -# This is transformed into a mu-law encoded vector. + ## usage: y = lin2mu (x) + ## + ## x is a vector of an 8- or 16-bit linearly encoded audio sample, + ## This is transformed into a mu-law encoded vector. -# Written by AW (Andreas.Weingessel@ci.tuwien.ac.at) on Oct 17, 1994 -# Copyright Department of Probability Theory and Statistics TU Wien + ## Written by AW (Andreas.Weingessel@ci.tuwien.ac.at) on Oct 17, 1994 + ## Copyright Department of Probability Theory and Statistics TU Wien if (nargin != 1) usage ("y = lin2mu (x)"); @@ -16,19 +35,19 @@ error ("lin2mu: x must be a vector"); endif - # transform 8-bit format to 16-bit + ## transform 8-bit format to 16-bit if (max (abs (x)) <= 128) x = 256 .* x; endif - # determine sign of x, set sign(0) = 1. + ## determine sign of x, set sign(0) = 1. sig = sign(x) + (x == 0); - # take absolute value of x, but force it to be smaller than 32636; - # add bias + ## take absolute value of x, but force it to be smaller than 32636; + ## add bias x = min (abs (x), 32635 * ones (size (x))) + 132; - # find exponent and fraction of bineary representation + ## find exponent and fraction of bineary representation [f, e] = log2 (x); y = 64 * sig - 16 * e - fix (32 * f) + 335;
--- a/scripts/audio/loadaudio.m +++ b/scripts/audio/loadaudio.m @@ -1,22 +1,41 @@ +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. + function X = loadaudio (name, ext, bit) -# usage: X = loadaudio (name [, ext [, bit]]) -# -# Loads audio data from the file "name.ext" into the data vector X. -# Default value for the "ext" argument, which has to be written -# without the initial ".", is "lin". -# Currently, the following audio formats are supported: -# *) mu-law encoding with extension "mu", "au" or "snd" -# *) linear encoding with extension "lin" or "raw" -# -# The `bit' argument can be either 8 (default) or 16. -# Depending on the value of bit, linearly encoded files are -# interpreted as being in 8 and 16 bit format, respectively, and -# mu-law encoded files are transformed to 8 and 16-bit linear -# format, respectively. + ## usage: X = loadaudio (name [, ext [, bit]]) + ## + ## Loads audio data from the file "name.ext" into the data vector X. + ## Default value for the "ext" argument, which has to be written + ## without the initial ".", is "lin". + ## Currently, the following audio formats are supported: + ## *) mu-law encoding with extension "mu", "au" or "snd" + ## *) linear encoding with extension "lin" or "raw" + ## + ## The `bit' argument can be either 8 (default) or 16. + ## Depending on the value of bit, linearly encoded files are + ## interpreted as being in 8 and 16 bit format, respectively, and + ## mu-law encoded files are transformed to 8 and 16-bit linear + ## format, respectively. -# Written by AW (Andreas.Weingessel@ci.tuwien.ac.at) on Apr 10, 1994 -# Last modified by AW on Oct 29, 1994 + ## Written by AW (Andreas.Weingessel@ci.tuwien.ac.at) on Apr 10, 1994 + ## Last modified by AW on Oct 29, 1994 if (nargin == 0 || nargin > 3) usage ("loadaudio (name [, ext [, bit]])"); @@ -44,7 +63,7 @@ endif elseif (strcmp (ext, "mu") || strcmp (ext, "au") || strcmp (ext, "snd")) [Y, c] = fread (num, inf, "uchar"); - # remove file header + ## remove file header m = max (find (Y(1:64) == 0)); if (! isempty (m)) Y(1:m) = [];
--- a/scripts/audio/mu2lin.m +++ b/scripts/audio/mu2lin.m @@ -1,15 +1,34 @@ +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. + function y = mu2lin (x, bit) -# usage: y = mu2lin (x [, bit]) -# -# If x is a vector of audio data with mu-law encoding, mu2lin (x) -# holds the same data with linear encoding. -# The optional argument bit specifies whether the input data is -# 8 bit (default) or 16 bit. + ## usage: y = mu2lin (x [, bit]) + ## + ## If x is a vector of audio data with mu-law encoding, mu2lin (x) + ## holds the same data with linear encoding. + ## The optional argument bit specifies whether the input data is + ## 8 bit (default) or 16 bit. -# Written by AW (Andreas.Weingessel@ci.tuwien.ac.at) on Oct 18, 1994 -# Updated by AW (Andreas.Weingessel@ci.tuwien.ac.at) on Oct 27, 1994 -# Copyright Department of Probability Theory and Statistics TU Wien + ## Written by AW (Andreas.Weingessel@ci.tuwien.ac.at) on Oct 18, 1994 + ## Updated by AW (Andreas.Weingessel@ci.tuwien.ac.at) on Oct 27, 1994 + ## Copyright Department of Probability Theory and Statistics TU Wien if (nargin == 1) bit = 8; @@ -27,20 +46,20 @@ exp_lut = [0; 132; 396; 924; 1980; 4092; 8316; 16764]; - # invert x bitwise + ## invert x bitwise x = 255 - x; - # determine sign of y + ## determine sign of y sig = (x > 127); - # determine exponent and fraction of y + ## determine exponent and fraction of y e = fix (x / 16) - 8 .* sig + 1; f = rem (x, 16); sig = 1 - 2 .* sig; y = (pow2 (f, e + 2) + exp_lut (e)) .* sig; - # convert to 8-bit + ## convert to 8-bit if (bit == 8) ld = max (abs (y)); if (ld < 16384)
--- a/scripts/audio/playaudio.m +++ b/scripts/audio/playaudio.m @@ -1,29 +1,48 @@ +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. + function playaudio (name, ext) -# usage: playaudio (name [, ext]) -# playaudio (X) -# -# `playaudio ("name" [, "ext"])' plays the audio file "name.ext". The -# default value for the "ext" argument, which has to be written -# without the initial ".", is "lin". -# Currently, the following audio formats are suppored: -# *) linear encoding with extension "lin" or "raw", played using -# /dev/dsp -# *) mu-law encoding with extension "mu", "au" or "snd", played -# using /dev/audio -# -# `playaudio (X)' plays the audio data contained in the vector X. + ## usage: playaudio (name [, ext]) + ## playaudio (X) + ## + ## `playaudio ("name" [, "ext"])' plays the audio file "name.ext". The + ## default value for the "ext" argument, which has to be written + ## without the initial ".", is "lin". + ## Currently, the following audio formats are suppored: + ## *) linear encoding with extension "lin" or "raw", played using + ## /dev/dsp + ## *) mu-law encoding with extension "mu", "au" or "snd", played + ## using /dev/audio + ## + ## `playaudio (X)' plays the audio data contained in the vector X. -# Written by AW (Andreas.Weingessel@ci.tuwien.ac.at) on Apr 11, 1994 -# Last modified by AW on Nov 7, 1994 -# Copyright Dept of Probability Theory and Statistics TU Wien + ## Written by AW (Andreas.Weingessel@ci.tuwien.ac.at) on Apr 11, 1994 + ## Last modified by AW on Nov 7, 1994 + ## Copyright Dept of Probability Theory and Statistics TU Wien file = octave_tmp_file_name (); usage_msg = "playaudio (name [, ext]) or playaudio (X)"; if (nargin == 1 && is_vector (name) && ! isstr (name)) - # play a vector + ## play a vector [nr, nc] = size (name); if (nc != 1) if (nr == 1) @@ -40,7 +59,7 @@ system (sprintf ("cat %s > /dev/dsp", file)); unlink (file); elseif (nargin >= 1 && isstr (name)) - # play a file + ## play a file if (nargin == 1) name = [name, ".lin"]; elseif (nargin == 2)
--- a/scripts/audio/record.m +++ b/scripts/audio/record.m @@ -1,15 +1,34 @@ +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. + function X = record (sec, sampling_rate) -# usage: X = record (sec [, sampling_rate]) -# -# Records sec seconds of audio into the vector X. -# The default value for the sampling_rate is 8000, ie. 8kHz. -# The program waits for you to hit the ENTER key, then the recording -# starts immediatly. + ## usage: X = record (sec [, sampling_rate]) + ## + ## Records sec seconds of audio into the vector X. + ## The default value for the sampling_rate is 8000, ie. 8kHz. + ## The program waits for you to hit the ENTER key, then the recording + ## starts immediatly. -# Written by AW (Andreas.Weingessel@ci.tuwien.ac.at) on Sep 19, 1994 -# Last modified by AW on Oct 5, 1994 -# Copyright Dept of Probability Theory and Statistics TU Wien + ## Written by AW (Andreas.Weingessel@ci.tuwien.ac.at) on Sep 19, 1994 + ## Last modified by AW on Oct 5, 1994 + ## Copyright Dept of Probability Theory and Statistics TU Wien if (nargin == 1) sampling_rate = 8000;
--- a/scripts/audio/saveaudio.m +++ b/scripts/audio/saveaudio.m @@ -1,3 +1,22 @@ +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. + function saveaudio (name, X, ext, bit) # usage: saveaudio (name, X, [, ext [, bit]])
--- a/scripts/audio/setaudio.m +++ b/scripts/audio/setaudio.m @@ -1,12 +1,31 @@ +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. + function setaudio (w_type, value) -# usage: setaudio ([w_type [, value]]) -# -# executes the shell command `mixer [w_type [, value]]' + ## usage: setaudio ([w_type [, value]]) + ## + ## executes the shell command `mixer [w_type [, value]]' -# Written by AW (Andreas.Weingessel@ci.tuwien.ac.at) on Oct 5, 1994 -# Updated by AW on Nov 3, 1994 -# Copyright Department of Probability Theory and Statistics TU Wien + ## Written by AW (Andreas.Weingessel@ci.tuwien.ac.at) on Oct 5, 1994 + ## Updated by AW on Nov 3, 1994 + ## Copyright Department of Probability Theory and Statistics TU Wien if (nargin == 0) system ("mixer");
--- a/scripts/control/abcddim.m +++ b/scripts/control/abcddim.m @@ -1,35 +1,36 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function [n, m, p] = abcddim (a, b, c, d) -# Usage: [n, m, p] = abcddim (a, b, c, d) -# -# Check for compatibility of the dimensions of the matrices defining -# the linear system (a, b, c, d). -# -# Returns n = number of system states, -# m = number of system inputs, -# p = number of system outputs. -# -# Returns n = m = p = -1 if the system is not compatible. + ## Usage: [n, m, p] = abcddim (a, b, c, d) + ## + ## Check for compatibility of the dimensions of the matrices defining + ## the linear system (a, b, c, d). + ## + ## Returns n = number of system states, + ## m = number of system inputs, + ## p = number of system outputs. + ## + ## Returns n = m = p = -1 if the system is not compatible. -# Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993. + ## Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993. if (nargin != 4) error ("usage: abcddim (a, b, c, d)");
--- a/scripts/control/are.m +++ b/scripts/control/are.m @@ -1,40 +1,41 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function x = are (a, b, c, opt) -# Usage: x = are (a, b, c {,opt}) -# -# Solves algebraic riccati equation -# -# a' x + x a - x b x + c = 0 -# -# for identically dimensioned square matrices a, b, c. If b (c) is not -# square, then the function attempts to use b * b' (c' * c) instead. -# -# Solution method: apply Laub's Schur method (IEEE Trans. Auto. Contr, -# 1979) to the appropriate Hamiltonian matrix. -# -# opt is an option passed to the eigenvalue balancing routine default is "B". -# -# See also: balance + ## Usage: x = are (a, b, c {,opt}) + ## + ## Solves algebraic riccati equation + ## + ## a' x + x a - x b x + c = 0 + ## + ## for identically dimensioned square matrices a, b, c. If b (c) is not + ## square, then the function attempts to use b * b' (c' * c) instead. + ## + ## Solution method: apply Laub's Schur method (IEEE Trans. Auto. Contr, + ## 1979) to the appropriate Hamiltonian matrix. + ## + ## opt is an option passed to the eigenvalue balancing routine default is "B". + ## + ## See also: balance -# Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993. + ## Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993. if (nargin == 3 || nargin == 4) if (nargin == 4) @@ -70,11 +71,11 @@ error ("are: a, b, c not conformably dimensioned."); endif -# Should check for controllability/observability here -# use Boley-Golub (Syst. Contr. Letters, 1984) method, not the -# -# n-1 -# rank ([ B A*B ... A^ *B]) method + ## Should check for controllability/observability here + ## use Boley-Golub (Syst. Contr. Letters, 1984) method, not the + ## + ## n-1 + ## rank ([ B A*B ... A^ *B]) method [d, h] = balance ([a, -b; -c, -a'], opt); [u, s] = schur (h, "A");
--- a/scripts/control/c2d.m +++ b/scripts/control/c2d.m @@ -1,39 +1,40 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function [Ad, Bd] = c2d (Ac, Bc, T) -# Usage: [Ad, Bd] = c2d (Ac, Bc, T) -# -# converts the continuous time system described by: -# . -# x = Ac x + Bc u -# -# into a discrete time equivalent model via the matrix exponential -# -# x[n+1] = Ad x[n] + Bd u[n] -# -# assuming a zero-order hold on the input and sample time T. + ## Usage: [Ad, Bd] = c2d (Ac, Bc, T) + ## + ## converts the continuous time system described by: + ## . + ## x = Ac x + Bc u + ## + ## into a discrete time equivalent model via the matrix exponential + ## + ## x[n+1] = Ad x[n] + Bd u[n] + ## + ## assuming a zero-order hold on the input and sample time T. -# Written by R.B. Tenison (btenison@eng.auburn.edu) -# October 1993 + ## Written by R.B. Tenison (btenison@eng.auburn.edu) + ## October 1993 -# check args + ## check args if (nargin != 3) usage ("c2d (Ac, Bc, T)"); endif
--- a/scripts/control/dare.m +++ b/scripts/control/dare.m @@ -1,51 +1,52 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function x = dare (a, b, c, r, opt) -# Usage: x = dare (a, b, c, r {,opt}) -# -# Solves discrete-time algebraic riccati equation -# -# a' x a - x + a' x b (r + b' x b)^{-1} b' x a + c = 0 -# -# for -# -# a: nxn -# b: nxm -# c: nxn, symmetric positive semidefinite -# r: mxm, invertible -# -# If c is not square, then the function attempts to use c'*c instead. -# -# Solution method: Laub's Schur method (IEEE Trans Auto Contr, 1979) applied -# to the appropriate symplectic matrix. -# -# See also: Ran and Rodman, "Stable Hermitian Solutions of Discrete -# Algebraic Riccati Equations," Mathematics of Control, Signals and -# Systems, Vol 5, no 2 (1992) pp 165-194. -# -# opt is an option passed to the eigenvalue balancing routine default -# is "B". -# -# See also: balance, are + ## Usage: x = dare (a, b, c, r {,opt}) + ## + ## Solves discrete-time algebraic riccati equation + ## + ## a' x a - x + a' x b (r + b' x b)^{-1} b' x a + c = 0 + ## + ## for + ## + ## a: nxn + ## b: nxm + ## c: nxn, symmetric positive semidefinite + ## r: mxm, invertible + ## + ## If c is not square, then the function attempts to use c'*c instead. + ## + ## Solution method: Laub's Schur method (IEEE Trans Auto Contr, 1979) applied + ## to the appropriate symplectic matrix. + ## + ## See also: Ran and Rodman, "Stable Hermitian Solutions of Discrete + ## Algebraic Riccati Equations," Mathematics of Control, Signals and + ## Systems, Vol 5, no 2 (1992) pp 165-194. + ## + ## opt is an option passed to the eigenvalue balancing routine default + ## is "B". + ## + ## See also: balance, are -# Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993. + ## Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993. if (nargin == 4 || nargin == 5) if (nargin == 5) @@ -57,12 +58,12 @@ opt = "B"; endif -# Check a matrix dimensions + ## Check a matrix dimensions if ((n = is_square (a)) == 0) error ("dare: a is not square"); endif -# Check a,b compatibility. + ## Check a,b compatibility. [n1, m] = size (b); @@ -74,7 +75,7 @@ warning ("dare: a,b are not controllable"); endif -# Check a,c compatibility. + ## Check a,c compatibility. if (is_observable (a, c) == 0) warning ("dare: a,c are not observable"); @@ -89,7 +90,7 @@ error ("dare: a,c are not conformable"); endif -# Check r dimensions. + ## Check r dimensions. if ((m1 = is_square (r)) == 0) warning ("dare: r is not square");
--- a/scripts/control/dgram.m +++ b/scripts/control/dgram.m @@ -1,32 +1,33 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function gramian = dgram (A, B) -# Usage: gramian = dgram (A, B) -# -# Returns the discrete controllability and observability gramian. -# -# dgram (A, B) returns the discrete controllability gramian. -# dgram (A', C') returns the observability gramian. + ## Usage: gramian = dgram (A, B) + ## + ## Returns the discrete controllability and observability gramian. + ## + ## dgram (A, B) returns the discrete controllability gramian. + ## dgram (A', C') returns the observability gramian. -# Written by R. Bruce Tenison (btenison@eng.auburn.edu) -# October 1993 + ## Written by R. Bruce Tenison (btenison@eng.auburn.edu) + ## October 1993 [U, Sig, V] = svd (B);
--- a/scripts/control/dlqe.m +++ b/scripts/control/dlqe.m @@ -1,56 +1,57 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function [l, m, p, e] = dlqe (a, g, c, sigw, sigv, zz) -# Usage: [l, m, p, e] = dlqe (A, G, C, SigW, SigV {,Z}) -# -# Linear quadratic estimator (Kalman filter) design for the -# discrete time system -# -# x[k+1] = A x[k] + B u[k] + G w[k] -# y[k] = C x[k] + D u[k] + w[k] -# -# where w, v are zero-mean gaussian noise processes with respective -# intensities SigW = cov (w, w) and SigV = cov (v, v). -# -# Z (if specified) is cov(w,v); otherwise cov(w,v) = 0. -# -# Observer structure is -# z[k+1] = A z[k] + B u[k] + k(y[k] - C z[k] - D u[k]). -# -# Returns: -# -# l = observer gain, (A - A L C) is stable -# m = Ricatti equation solution -# p = the estimate error covariance after the measurement update -# e = closed loop poles of (A - A L C) + ## Usage: [l, m, p, e] = dlqe (A, G, C, SigW, SigV {,Z}) + ## + ## Linear quadratic estimator (Kalman filter) design for the + ## discrete time system + ## + ## x[k+1] = A x[k] + B u[k] + G w[k] + ## y[k] = C x[k] + D u[k] + w[k] + ## + ## where w, v are zero-mean gaussian noise processes with respective + ## intensities SigW = cov (w, w) and SigV = cov (v, v). + ## + ## Z (if specified) is cov(w,v); otherwise cov(w,v) = 0. + ## + ## Observer structure is + ## z[k+1] = A z[k] + B u[k] + k(y[k] - C z[k] - D u[k]). + ## + ## Returns: + ## + ## l = observer gain, (A - A L C) is stable + ## m = Ricatti equation solution + ## p = the estimate error covariance after the measurement update + ## e = closed loop poles of (A - A L C) -# Written by A. S. Hodel (scotte@eng.auburn.edu) August, 1993. -# Modified for discrete time by R. Bruce Tenison (btenison@eng.auburn.edu) -# October, 1993 + ## Written by A. S. Hodel (scotte@eng.auburn.edu) August, 1993. + ## Modified for discrete time by R. Bruce Tenison (btenison@eng.auburn.edu) + ## October, 1993 if (nargin != 5 && nargin != 6) error ("dlqe: invalid number of arguments"); endif -# The problem is dual to the regulator design, so transform to lqr -# call. + ## The problem is dual to the regulator design, so transform to lqr + ## call. if (nargin == 5) [k, p, e] = dlqr (a', c', g*sigw*g', sigv);
--- a/scripts/control/dlqr.m +++ b/scripts/control/dlqr.m @@ -1,81 +1,82 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function [k, p, e] = dlqr (a, b, q, r, zz) -# Usage: [k, p, e] = dlqr (A, B, Q, R {,Z}) -# -# Linear quadratic regulator design for the discrete time system -# -# x[k+1] = A x[k] + B u[k] -# -# to minimize the cost functional -# -# J = Sum { x' Q x + u' R u } Z omitted -# -# or -# -# J = Sum { x' Q x + u' R u +2 x' Z u} Z included -# -# Returns: -# -# k = state feedback gain, (A - B K) is stable -# p = solution of algebraic Riccati equation -# e = closed loop poles of (A - B K) + ## Usage: [k, p, e] = dlqr (A, B, Q, R {,Z}) + ## + ## Linear quadratic regulator design for the discrete time system + ## + ## x[k+1] = A x[k] + B u[k] + ## + ## to minimize the cost functional + ## + ## J = Sum { x' Q x + u' R u } Z omitted + ## + ## or + ## + ## J = Sum { x' Q x + u' R u +2 x' Z u} Z included + ## + ## Returns: + ## + ## k = state feedback gain, (A - B K) is stable + ## p = solution of algebraic Riccati equation + ## e = closed loop poles of (A - B K) -# Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993. -# Converted to discrete time by R. B. Tenison -# (btenison@eng.auburn.edu) October 1993 + ## Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993. + ## Converted to discrete time by R. B. Tenison + ## (btenison@eng.auburn.edu) October 1993 if (nargin != 4 && nargin != 5) error ("dlqr: invalid number of arguments"); endif -# Check a. + ## Check a. if ((n = is_square (a)) == 0) error ("dlqr: requires 1st parameter(a) to be square"); endif -# Check b. + ## Check b. [n1, m] = size (b); if (n1 != n) error ("dlqr: a,b not conformal"); endif -# Check q. + ## Check q. if ((n1 = is_square (q)) == 0 || n1 != n) error ("dlqr: q must be square and conformal with a"); endif -# Check r. + ## Check r. if((m1 = is_square(r)) == 0 || m1 != m) error ("dlqr: r must be square and conformal with column dimension of b"); endif -# Check if n is there. + ## Check if n is there. if (nargin == 5) [n1, m1] = size (zz); if (n1 != n || m1 != m) error ("dlqr: z must be identically dimensioned with b"); endif -# Incorporate cross term into a and q. + ## Incorporate cross term into a and q. ao = a - (b/r)*zz'; qo = q - (zz/r)*zz'; @@ -85,7 +86,7 @@ qo = q; endif -# Check that q, (r) are symmetric, positive (semi)definite + ## Check that q, (r) are symmetric, positive (semi)definite if (is_symmetric (q) && is_symmetric (r) ... && all (eig (q) >= 0) && all (eig (r) > 0))
--- a/scripts/control/dlyap.m +++ b/scripts/control/dlyap.m @@ -1,39 +1,40 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function x = dlyap (a, b) -# Usage: x = dlyap (a, b) -# -# Solve a x a' - x + b = 0 (discrete Lyapunov equation) for square -# matrices a and b. If b is not square, then the function attempts -# to solve either -# -# a x a' - x + b b' = 0 -# -# or -# -# a' x a - x + b' b = 0 -# -# whichever is appropriate. Uses Schur decomposition as in Kitagawa -# (1977). + ## Usage: x = dlyap (a, b) + ## + ## Solve a x a' - x + b = 0 (discrete Lyapunov equation) for square + ## matrices a and b. If b is not square, then the function attempts + ## to solve either + ## + ## a x a' - x + b b' = 0 + ## + ## or + ## + ## a' x a - x + b' b = 0 + ## + ## whichever is appropriate. Uses Schur decomposition as in Kitagawa + ## (1977). -# Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993. + ## Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993. if ((n = is_square (a)) == 0) warning ("dlyap: a must be square"); @@ -54,7 +55,7 @@ warning ("dlyap: a,b not conformably dimensioned"); endif - # Solve the equation column by column. + ## Solve the equation column by column. [u, s] = schur (a); b = u'*b*u; @@ -63,7 +64,7 @@ while (j > 0) j1 = j; -# Check for Schur block. + ## Check for Schur block. if (j == 1) blksiz = 1; @@ -94,7 +95,7 @@ endwhile -# Back-transform to original coordinates. + ## Back-transform to original coordinates. x = u*x*u';
--- a/scripts/control/is_controllable.m +++ b/scripts/control/is_controllable.m @@ -1,42 +1,43 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = is_controllable (a, b, tol) -# Usage: is_controllable (a, b {,tol}) -# -# Returns 1 if the pair (a, b) is controllable, or 0 if not. -# -# See also: size, rows, columns, length, is_matrix, is_scalar, is_vector -# -# This should really use the method below, but I'm being lazy for now: -# -# Controllability is determined by applying Arnoldi iteration with -# complete re-orthogonalization to obtain an orthogonal basis of the -# Krylov subspace. -# -# (FIX ME... The Krylov subspace approach is not done yet!) -# n-1 -# span ([b,a*b,...,a^ b]). -# -# tol is a roundoff paramter, set to 2*eps if omitted. + ## Usage: is_controllable (a, b {,tol}) + ## + ## Returns 1 if the pair (a, b) is controllable, or 0 if not. + ## + ## See also: size, rows, columns, length, is_matrix, is_scalar, is_vector + ## + ## This should really use the method below, but I'm being lazy for now: + ## + ## Controllability is determined by applying Arnoldi iteration with + ## complete re-orthogonalization to obtain an orthogonal basis of the + ## Krylov subspace. + ## + ## (FIX ME... The Krylov subspace approach is not done yet!) + ## n-1 + ## span ([b,a*b,...,a^ b]). + ## + ## tol is a roundoff paramter, set to 2*eps if omitted. -# Written by A. S. Hodel (scotte@eng.auburn.edu) August, 1993. + ## Written by A. S. Hodel (scotte@eng.auburn.edu) August, 1993. if (nargin == 2 || nargin == 3) @@ -54,7 +55,7 @@ m = [m, tmp]; endfor -# If n is of any significant size, m will be low rank, so be careful! + ## If n is of any significant size, m will be low rank, so be careful! if (nargin == 3) if (is_scalar (tol))
--- a/scripts/control/is_observable.m +++ b/scripts/control/is_observable.m @@ -1,30 +1,31 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = is_observable (a,c,tol) -# usage: is_observable (a, c {,tol}) -# -# Returns 1 if the pair (a, c) is observable, or 0 if not. -# -# See also: size, rows, columns, length, is_matrix, is_scalar, is_vector. + ## usage: is_observable (a, c {,tol}) + ## + ## Returns 1 if the pair (a, c) is observable, or 0 if not. + ## + ## See also: size, rows, columns, length, is_matrix, is_scalar, is_vector. -# Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993. + ## Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993. if (nargin == 2) retval = is_controllable (a', c');
--- a/scripts/control/lqe.m +++ b/scripts/control/lqe.m @@ -1,52 +1,53 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function [k, p, e] = lqe (a, g, c, sigw, sigv, zz) -# Usage: [k, p, e] = lqe (A, G, C, SigW, SigV {,Z}) -# -# Linear quadratic estimator (Kalman filter) design for the -# continuous time system -# -# dx/dt = A x + B u + G w -# y = C x + D u + v -# -# where w, v are zero-mean gaussian noise processes with respective -# intensities SigW = cov (w, w) and SigV = cov (v, v). -# -# Z (if specified) is cov(w,v); otherwise cov(w,v) = 0. -# -# Observer structure is dz/dt = A z + B u + k( y - C z - D u). -# -# Returns: -# -# k = observer gain, (A - K C) is stable -# p = solution of algebraic Riccati equation -# e = closed loop poles of (A - K C) + ## Usage: [k, p, e] = lqe (A, G, C, SigW, SigV {,Z}) + ## + ## Linear quadratic estimator (Kalman filter) design for the + ## continuous time system + ## + ## dx/dt = A x + B u + G w + ## y = C x + D u + v + ## + ## where w, v are zero-mean gaussian noise processes with respective + ## intensities SigW = cov (w, w) and SigV = cov (v, v). + ## + ## Z (if specified) is cov(w,v); otherwise cov(w,v) = 0. + ## + ## Observer structure is dz/dt = A z + B u + k( y - C z - D u). + ## + ## Returns: + ## + ## k = observer gain, (A - K C) is stable + ## p = solution of algebraic Riccati equation + ## e = closed loop poles of (A - K C) -# Written by A. S. Hodel (scotte@eng.auburn.edu) August, 1993. + ## Written by A. S. Hodel (scotte@eng.auburn.edu) August, 1993. if (nargin != 5 && nargin != 6) error ("lqe: invalid number of arguments"); endif -# The problem is dual to the regulator design, so transform to lqr -# call. + ## The problem is dual to the regulator design, so transform to lqr + ## call. if (nargin == 5) [k, p, e] = lqr (a', c', g*sigw*g', sigv);
--- a/scripts/control/lqr.m +++ b/scripts/control/lqr.m @@ -1,79 +1,80 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function [k, p, e] = lqr (a, b, q, r, zz) -# Usage: [k, p, e] = lqr (A, B, Q, R {,Z}) -# -# Linear quadratic regulator design for the continuous time system -# -# dx/dt = A x + B u -# -# to minimize the cost functional -# -# J = int_0^\infty{ x' Q x + u' R u } Z omitted -# -# or -# -# J = int_0^\infty{ x' Q x + u' R u +2 x' Z u} Z included -# -# Returns: -# -# k = state feedback gain, (A - B K) is stable -# p = solution of algebraic Riccati equation -# e = closed loop poles of (A - B K) + ## Usage: [k, p, e] = lqr (A, B, Q, R {,Z}) + ## + ## Linear quadratic regulator design for the continuous time system + ## + ## dx/dt = A x + B u + ## + ## to minimize the cost functional + ## + ## J = int_0^\infty{ x' Q x + u' R u } Z omitted + ## + ## or + ## + ## J = int_0^\infty{ x' Q x + u' R u +2 x' Z u} Z included + ## + ## Returns: + ## + ## k = state feedback gain, (A - B K) is stable + ## p = solution of algebraic Riccati equation + ## e = closed loop poles of (A - B K) -# Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993. + ## Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993. if (nargin != 4 && nargin != 5) error ("lqr: invalid number of arguments"); endif -# Check a. + ## Check a. if ((n = is_square (a)) == 0) error ("lqr: requires 1st parameter(a) to be square"); endif -# Check b. + ## Check b. [n1, m] = size (b); if (n1 != n) error ("lqr: a,b not conformal"); endif -# Check q. + ## Check q. if ((n1 = is_square (q)) == 0 || n1 != n) error ("lqr: q must be square and conformal with a"); endif -# Check r. + ## Check r. if((m1 = is_square(r)) == 0 || m1 != m) error ("lqr: r must be square and conformal with column dimension of b"); endif -# Check if n is there. + ## Check if n is there. if (nargin == 5) [n1, m1] = size (zz); if (n1 != n || m1 != m) error ("lqr: z must be identically dimensioned with b"); endif -# Incorporate cross term into a and q. + ## Incorporate cross term into a and q. ao = a - (b/r)*zz'; qo = q - (zz/r)*zz'; @@ -83,7 +84,7 @@ qo = q; endif -# Check that q, (r) are symmetric, positive (semi)definite + ## Check that q, (r) are symmetric, positive (semi)definite if (is_symmetric (q) && is_symmetric (r) ... && all (eig (q) >= 0) && all (eig (r) > 0))
--- a/scripts/control/lyap.m +++ b/scripts/control/lyap.m @@ -1,48 +1,49 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function x = lyap (a, b, c) -# Usage: x = lyap (a, b {,c}) -# -# If (a, b, c) are specified, then lyap returns the solution of the -# Sylvester equation -# -# a x + x b + c = 0 -# -# If only (a, b) are specified, then lyap returns the solution of the -# Lyapunov equation -# -# a' x + x a + b = 0 -# -# If b is not square, then lyap returns the solution of either -# -# a' x + x a + b' b = 0 -# -# or -# -# a x + x a' + b b' = 0 -# -# whichever is appropriate. -# -# Solves by using the Bartels-Stewart algorithm (1972). + ## Usage: x = lyap (a, b {,c}) + ## + ## If (a, b, c) are specified, then lyap returns the solution of the + ## Sylvester equation + ## + ## a x + x b + c = 0 + ## + ## If only (a, b) are specified, then lyap returns the solution of the + ## Lyapunov equation + ## + ## a' x + x a + b = 0 + ## + ## If b is not square, then lyap returns the solution of either + ## + ## a' x + x a + b' b = 0 + ## + ## or + ## + ## a x + x a' + b b' = 0 + ## + ## whichever is appropriate. + ## + ## Solves by using the Bartels-Stewart algorithm (1972). -# Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993. + ## Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993. if (nargin != 3 && nargin != 2) @@ -55,18 +56,18 @@ if (nargin == 2) -# Transform Lyapunov equation to Sylvester equation form. + ## Transform Lyapunov equation to Sylvester equation form. if ((m = is_square (b)) == 0) if ((m = rows (b)) == n) -# solve a x + x a' + b b' = 0 + ## solve a x + x a' + b b' = 0 b = b * b'; a = a'; else -# Try to solve a'x + x a + b' b = 0. + ## Try to solve a'x + x a + b' b = 0. m = columns (b); b = b' * b; @@ -77,7 +78,7 @@ endif endif -# Set up Sylvester equation. + ## Set up Sylvester equation. c = b; b = a; @@ -85,7 +86,7 @@ else -# Check dimensions. + ## Check dimensions. if ((m = is_square (b)) == 0) error ("lyap: b must be square in a sylvester equation"); @@ -98,7 +99,7 @@ endif endif -# Call octave built-in function. + ## Call octave built-in function. x = syl (a, b, c);
--- a/scripts/control/tzero.m +++ b/scripts/control/tzero.m @@ -1,32 +1,33 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function zr = tzero (a, b, c, d, bal) -# Usage: zr = tzero (a, b, c, d, bal) -# -# Compute the transmission zeros of a, b, c, d. -# -# bal = balancing option (see balance); default is "B". -# -# Needs to incorporate mvzero algorithm to isolate finite zeros. + ## Usage: zr = tzero (a, b, c, d, bal) + ## + ## Compute the transmission zeros of a, b, c, d. + ## + ## bal = balancing option (see balance); default is "B". + ## + ## Needs to incorporate mvzero algorithm to isolate finite zeros. -# Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993. + ## Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993. if (nargin == 4) bal = "B";
--- a/scripts/elfun/acot.m +++ b/scripts/elfun/acot.m @@ -1,6 +1,25 @@ +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. + function w = acot (z) -# acot (z): compute the inverse cotangent for each element of z. + ## acot (z): compute the inverse cotangent for each element of z. if (nargin != 1) usage ("acot (z)");
--- a/scripts/elfun/acoth.m +++ b/scripts/elfun/acoth.m @@ -1,6 +1,25 @@ +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. + function w = acoth (z) -# acoth (z): compute the inverse hyperbolic cotangent for each element of z. + ## acoth (z): compute the inverse hyperbolic cotangent for each element of z. if (nargin != 1) usage ("acoth (z)");
--- a/scripts/elfun/acsc.m +++ b/scripts/elfun/acsc.m @@ -1,6 +1,25 @@ +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. + function w = acsc (z) -# acsc (z): compute the inverse cosecant for each element of z. + ## acsc (z): compute the inverse cosecant for each element of z. if (nargin != 1) usage ("acsc (z)");
--- a/scripts/elfun/acsch.m +++ b/scripts/elfun/acsch.m @@ -1,6 +1,25 @@ +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. + function w = acsch (z) -# acsch (z): compute the inverse hyperbolic cosecant for each element of z. + ## acsch (z): compute the inverse hyperbolic cosecant for each element of z. if (nargin != 1) usage ("acsch (z)");
--- a/scripts/elfun/asec.m +++ b/scripts/elfun/asec.m @@ -1,6 +1,25 @@ +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. + function w = asec (z) -# asec (z): compute the inverse secant for each element of z. + ## asec (z): compute the inverse secant for each element of z. if (nargin != 1) usage ("asec (z)");
--- a/scripts/elfun/asech.m +++ b/scripts/elfun/asech.m @@ -1,6 +1,25 @@ +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. + function w = asech (z) -# asech (z): compute the inverse hyperbolic secant for each element of z. + ## asech (z): compute the inverse hyperbolic secant for each element of z. if (nargin != 1) usage ("acosh (z)");
--- a/scripts/elfun/cot.m +++ b/scripts/elfun/cot.m @@ -1,6 +1,25 @@ +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. + function w = cot (z) -# cot (z): compute the cotangent for each element of z. + ## cot (z): compute the cotangent for each element of z. if (nargin != 1) usage ("cot (z)");
--- a/scripts/elfun/coth.m +++ b/scripts/elfun/coth.m @@ -1,6 +1,25 @@ +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. + function w = coth (z) -# coth (z): compute the hyperbolic cotangent for each element of z. + ## coth (z): compute the hyperbolic cotangent for each element of z. if (nargin != 1) usage ("coth (z)");
--- a/scripts/elfun/csc.m +++ b/scripts/elfun/csc.m @@ -1,6 +1,25 @@ +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. + function w = csc (z) -# csc (z): compute the cosecant for each element of z. + ## csc (z): compute the cosecant for each element of z. if (nargin != 1) usage ("csc (z)");
--- a/scripts/elfun/csch.m +++ b/scripts/elfun/csch.m @@ -1,6 +1,25 @@ +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. + function w = csch (z) -# csch (z): compute the hyperbolic cosecant for each element of z. + ## csch (z): compute the hyperbolic cosecant for each element of z. if (nargin != 1) usage ("csch (z)");
--- a/scripts/elfun/gcd.m +++ b/scripts/elfun/gcd.m @@ -1,32 +1,33 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function [g, v] = gcd (a, ...) -# usage: gcd (a, ...) -# -# [g [, v]] = gcd (a) returns the greatest common divisor g of the -# entries of the integer vector a, and an integer vector v such that -# g = v(1) * a(k) + ... + v(k) * a(k). -# -# [g [, v]] = gcd (a1, ..., ak) is the same with a = [a1, ..., ak]. + ## usage: gcd (a, ...) + ## + ## [g [, v]] = gcd (a) returns the greatest common divisor g of the + ## entries of the integer vector a, and an integer vector v such that + ## g = v(1) * a(k) + ... + v(k) * a(k). + ## + ## [g [, v]] = gcd (a1, ..., ak) is the same with a = [a1, ..., ak]. -# Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Sep 16, 1994. + ## Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Sep 16, 1994. if (nargin > 1) va_start;
--- a/scripts/elfun/lcm.m +++ b/scripts/elfun/lcm.m @@ -1,30 +1,31 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function l = lcm (a, ...) -# usage: lcm (a, ...) -# -# lcm (a) returns the least common multiple of the entries of the -# integer vector a. -# lcm (a1, ..., ak) is the same as lcm([a1, ..., ak]). + ## usage: lcm (a, ...) + ## + ## lcm (a) returns the least common multiple of the entries of the + ## integer vector a. + ## lcm (a1, ..., ak) is the same as lcm([a1, ..., ak]). -# Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Sep 16, 1994. + ## Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Sep 16, 1994. if (nargin > 1) va_start;
--- a/scripts/elfun/log2.m +++ b/scripts/elfun/log2.m @@ -1,6 +1,25 @@ +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. + function w = log2 (z) -# log2 (z): compute the logarithm base 2 for each element of z. + ## log2 (z): compute the logarithm base 2 for each element of z. if (nargin != 1) usage ("log2 (z)");
--- a/scripts/elfun/sec.m +++ b/scripts/elfun/sec.m @@ -1,6 +1,25 @@ +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. + function w = sec (z) -# sec (z): compute the secant for each element of z. + ## sec (z): compute the secant for each element of z. if (nargin != 1) usage ("sec (z)");
--- a/scripts/elfun/sech.m +++ b/scripts/elfun/sech.m @@ -1,6 +1,25 @@ +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. + function w = sech (z) -# sech (z): compute the hyperbolic secant for each element of z. + ## sech (z): compute the hyperbolic secant for each element of z. if (nargin != 1) usage ("sech (z)");
--- a/scripts/general/columns.m +++ b/scripts/general/columns.m @@ -1,28 +1,29 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function nc = columns (x) -# usage: columns (x) -# -# Return the the number of columns in x. -# -# See also: size, rows, length, is_scalar, is_vector, is_matrix + ## usage: columns (x) + ## + ## Return the the number of columns in x. + ## + ## See also: size, rows, length, is_scalar, is_vector, is_matrix if (nargin != 1) usage ("columns (x)");
--- a/scripts/general/fliplr.m +++ b/scripts/general/fliplr.m @@ -1,28 +1,29 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function y = fliplr (x) -# usage: fliplr (x) -# -# Return x with the columns swapped. -# -# See also: flipu, rot90 + ## usage: fliplr (x) + ## + ## Return x with the columns swapped. + ## + ## See also: flipu, rot90 if (nargin != 1) usage ("fliplr (x)");
--- a/scripts/general/flipud.m +++ b/scripts/general/flipud.m @@ -1,28 +1,29 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function y = flipud (x) -# usage: flipud (x) -# -# Return x with the rows swapped. -# -# See also: fliplr, rot90 + ## usage: flipud (x) + ## + ## Return x with the rows swapped. + ## + ## See also: fliplr, rot90 if (nargin != 1) usage ("flipud (x)");
--- a/scripts/general/int2str.m +++ b/scripts/general/int2str.m @@ -1,30 +1,31 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = int2str (x) -# usage: int2str (x) -# -# Round x to the nearest integer and format as a string. -# -# See also: sprintf, num2str + ## usage: int2str (x) + ## + ## Round x to the nearest integer and format as a string. + ## + ## See also: sprintf, num2str -# XXX FIXME XXX -- this will fail for very large values. + ## XXX FIXME XXX -- this will fail for very large values. if (nargin == 1) if (rows (x) == 1 && columns (x) == 1)
--- a/scripts/general/is_matrix.m +++ b/scripts/general/is_matrix.m @@ -1,29 +1,30 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = is_matrix (x) -# usage: is_matrix (x) -# -# Return 1 if the number of rows and columns of x are both greater -# than 1. -# -# See also: size, rows, columns, length, is_scalar, is_vector + ## usage: is_matrix (x) + ## + ## Return 1 if the number of rows and columns of x are both greater + ## than 1. + ## + ## See also: size, rows, columns, length, is_scalar, is_vector if (nargin == 1) [nr, nc] = size (x);
--- a/scripts/general/is_scalar.m +++ b/scripts/general/is_scalar.m @@ -1,28 +1,29 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = is_scalar (x) -# usage: is_scalar (x) -# -# Return 1 if the number of rows and columns of x are both equal to 1. -# -# See also: size, rows, columns, length, is_scalar, is_matrix + ## usage: is_scalar (x) + ## + ## Return 1 if the number of rows and columns of x are both equal to 1. + ## + ## See also: size, rows, columns, length, is_scalar, is_matrix if (nargin == 1) [nr, nc] = size (x);
--- a/scripts/general/is_square.m +++ b/scripts/general/is_square.m @@ -1,31 +1,32 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = is_square (x) -# usage: is_square (x) -# -# If x is square, then return value is the dimension of x. -# otherwise, returns a value of 0 -# -# See also: size, rows, columns, length, is_matrix, is_scalar, is_vector + ## usage: is_square (x) + ## + ## If x is square, then return value is the dimension of x. + ## otherwise, returns a value of 0 + ## + ## See also: size, rows, columns, length, is_matrix, is_scalar, is_vector -# Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993. + ## Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993. if (nargin == 1) [nr, nc] = size (x);
--- a/scripts/general/is_symmetric.m +++ b/scripts/general/is_symmetric.m @@ -1,31 +1,32 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = is_symmetric (x,tol) -# Usage: is_symmetric (x {,tol}) -# -# If x is symmetric, return the dimension of x, otherwise, return 0. -# -# See also: size, rows, columns, length, is_matrix, is_scalar, -# is_square, is_vector + ## Usage: is_symmetric (x {,tol}) + ## + ## If x is symmetric, return the dimension of x, otherwise, return 0. + ## + ## See also: size, rows, columns, length, is_matrix, is_scalar, + ## is_square, is_vector -# Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993. + ## Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993. if (nargin == 1 || nargin == 2) if ((retval = is_square (x)))
--- a/scripts/general/is_vector.m +++ b/scripts/general/is_vector.m @@ -1,29 +1,30 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = is_vector (x) -# usage: is_vector (x) -# -# Return 1 if the either the number of rows (columns) of x is 1 and -# the number of columns (rows) is greater than one. Otherwise, return 0. -# -# See also: size, rows, columns, length, is_scalar, is_matrix + ## usage: is_vector (x) + ## + ## Return 1 if the either the number of rows (columns) of x is 1 and + ## the number of columns (rows) is greater than one. Otherwise, return 0. + ## + ## See also: size, rows, columns, length, is_scalar, is_matrix if (nargin == 1) [nr, nc] = size (x);
--- a/scripts/general/isempty.m +++ b/scripts/general/isempty.m @@ -1,26 +1,27 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = isempty (var) -# usage: isempty (x) -# -# Return 1 if the argument is an empty matrix. Otherwise, return 0. + ## usage: isempty (x) + ## + ## Return 1 if the argument is an empty matrix. Otherwise, return 0. if (nargin != 1) usage ("isempty (var)");
--- a/scripts/general/length.m +++ b/scripts/general/length.m @@ -1,28 +1,29 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function len = length (x) -# usage: length (x) -# -# Return the number of rows or columns, whichever is greater. -# -# See also: size, rows, columns, is_scalar, is_vector, is_matrix + ## usage: length (x) + ## + ## Return the number of rows or columns, whichever is greater. + ## + ## See also: size, rows, columns, is_scalar, is_vector, is_matrix if (nargin != 1) usage ("length (x)");
--- a/scripts/general/logspace.m +++ b/scripts/general/logspace.m @@ -1,40 +1,41 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = logspace (x1, x2, n) -# usage: logspace (x1, x2, n) -# -# Return a vector of n logarithmically equally spaced points between -# x1 and x2 inclusive. -# -# If the final argument is omitted, n = 50 is assumed. -# -# All three arguments must be scalars. -# -# Note that if if x2 is pi, the points are between 10^x1 and pi, NOT -# 10^x1 and 10^pi. -# -# Yes, this is pretty stupid, because you could achieve the same -# result with logspace (x1, log10 (pi)), but Matlab does this, and -# claims that is useful for signal processing applications. -# -# See also: linspace + ## usage: logspace (x1, x2, n) + ## + ## Return a vector of n logarithmically equally spaced points between + ## x1 and x2 inclusive. + ## + ## If the final argument is omitted, n = 50 is assumed. + ## + ## All three arguments must be scalars. + ## + ## Note that if if x2 is pi, the points are between 10^x1 and pi, NOT + ## 10^x1 and 10^pi. + ## + ## Yes, this is pretty stupid, because you could achieve the same + ## result with logspace (x1, log10 (pi)), but Matlab does this, and + ## claims that is useful for signal processing applications. + ## + ## See also: linspace if (nargin == 2) npoints = 50;
--- a/scripts/general/nargchk.m +++ b/scripts/general/nargchk.m @@ -1,28 +1,29 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = nargchk (nargin_min, nargin_max, n) -# usage: nargchk (nargin_min, nargin_max, n) -# -# If N is in the range NARGIN_MIN to NARGIN_MAX, return the empty -# matrix. Otherwise, return a message indicating whether N is too -# large or too small. + ## usage: nargchk (nargin_min, nargin_max, n) + ## + ## If N is in the range NARGIN_MIN to NARGIN_MAX, return the empty + ## matrix. Otherwise, return a message indicating whether N is too + ## large or too small. if (nargin != 3) usage ("nargchk (nargin_min, nargin_max, n)");
--- a/scripts/general/num2str.m +++ b/scripts/general/num2str.m @@ -1,28 +1,29 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = num2str (x) -# usage: num2str (x) -# -# Format x as a string. -# -# See also: sprintf, int2str + ## usage: num2str (x) + ## + ## Format x as a string. + ## + ## See also: sprintf, int2str if (nargin == 1) if (rows (x) == 1 && columns (x) == 1)
--- a/scripts/general/perror.m +++ b/scripts/general/perror.m @@ -1,33 +1,34 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function perror (name, err) -# usage: perror (name, err) -# -# Print an error message for error number `err' from function "name". -# -# Messages correspond to the following subroutine versions: -# -# npsol : 4.0 -# qpsol : 3.2 -# -# See also: strerror + ## usage: perror (name, err) + ## + ## Print an error message for error number `err' from function "name". + ## + ## Messages correspond to the following subroutine versions: + ## + ## npsol : 4.0 + ## qpsol : 3.2 + ## + ## See also: strerror if (nargin != 2) usage ("perror (name, err)");
--- a/scripts/general/postpad.m +++ b/scripts/general/postpad.m @@ -1,17 +1,36 @@ +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. + function y = postpad (x, l, c) -# postpad (x, l) -# -# Appends zeros to the vector x until it is of length l. -# postpad (x, l, c) appends the constant c instead of zero. -# -# If length (x) > l, elements from the end of x are removed -# until a vector of length l is obtained. + ## postpad (x, l) + ## + ## Appends zeros to the vector x until it is of length l. + ## postpad (x, l, c) appends the constant c instead of zero. + ## + ## If length (x) > l, elements from the end of x are removed + ## until a vector of length l is obtained. -# Author: -# Tony Richardson -# amr@mpl.ucsd.edu -# June 1994 + ## Author: + ## Tony Richardson + ## amr@mpl.ucsd.edu + ## June 1994 if (nargin == 2) c = 0;
--- a/scripts/general/prepad.m +++ b/scripts/general/prepad.m @@ -1,17 +1,36 @@ +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. + function y = prepad (x, l, c) -# prepad (x, l) -# -# Prepends zeros to the vector x until it is of length l. -# prepad(x,l,c) prepends the constant c instead of zero. -# -# If length (x) > l, elements from the beginning of x are removed -# until a vector of length l is obtained. + ## prepad (x, l) + ## + ## Prepends zeros to the vector x until it is of length l. + ## prepad(x,l,c) prepends the constant c instead of zero. + ## + ## If length (x) > l, elements from the beginning of x are removed + ## until a vector of length l is obtained. -# Author: -# Tony Richardson -# amr@mpl.ucsd.edu -# June 1994 + ## Author: + ## Tony Richardson + ## amr@mpl.ucsd.edu + ## June 1994 if (nargin == 2) c = 0;
--- a/scripts/general/rem.m +++ b/scripts/general/rem.m @@ -1,26 +1,27 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = rem (x, y) -# usage: rem (x, y) -# -# Return remainder (x, y). + ## usage: rem (x, y) + ## + ## Return remainder (x, y). if (nargin != 2) usage ("rem (x, y)"); @@ -30,8 +31,8 @@ error ("rem: argument sizes must agree"); endif -# Matlab allows complex arguments, but as far as I can tell, that's a -# bunch of hooey. + ## Matlab allows complex arguments, but as far as I can tell, that's a + ## bunch of hooey. if (any (any (imag (x))) || any (any (imag (y)))) error ("rem: complex arguments are not allowed");
--- a/scripts/general/reshape.m +++ b/scripts/general/reshape.m @@ -1,29 +1,30 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = reshape (a, m, n) -# usage: reshape (a, m, n) -# -# Form an m x n matrix from the elements of a (taken in Fortran's -# column major ordering). -# -# See also: `:', do_fortran_indexing + ## usage: reshape (a, m, n) + ## + ## Form an m x n matrix from the elements of a (taken in Fortran's + ## column major ordering). + ## + ## See also: `:', do_fortran_indexing if (nargin != 3) usage ("reshape (a, m, n)");
--- a/scripts/general/rot90.m +++ b/scripts/general/rot90.m @@ -1,30 +1,31 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function y = rot90 (x, k) -# usage: rot90 (x, k) -# -# Rotate the matrix x counterclockwise k*90 degrees. -# -# If the second argument is omitted, k is taken to be 1. -# -# See also: flipud, fliplr + ## usage: rot90 (x, k) + ## + ## Rotate the matrix x counterclockwise k*90 degrees. + ## + ## If the second argument is omitted, k is taken to be 1. + ## + ## See also: flipud, fliplr if (nargin < 2) k = 1;
--- a/scripts/general/rows.m +++ b/scripts/general/rows.m @@ -1,28 +1,29 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function nr = rows (x) -# usage: rows (x) -# -# Return the the number of rows in x. -# -# See also: size, columns, length, is_scalar, is_vector, is_matrix + ## usage: rows (x) + ## + ## Return the the number of rows in x. + ## + ## See also: size, columns, length, is_scalar, is_vector, is_matrix if (nargin != 1) usage ("rows (x)");
--- a/scripts/general/strerror.m +++ b/scripts/general/strerror.m @@ -1,32 +1,33 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function msg = strerror (name, err) -# usage: msg = strerror (name, err) -# -# Return the text of an error message for error number `err' from -# function "name". -# -# Messages correspond to the following subroutine versions: -# -# npsol : 4.0 -# qpsol : 3.2 + ## usage: msg = strerror (name, err) + ## + ## Return the text of an error message for error number `err' from + ## function "name". + ## + ## Messages correspond to the following subroutine versions: + ## + ## npsol : 4.0 + ## qpsol : 3.2 if (nargin != 2) usage ("strerror (name, err)");
--- a/scripts/general/tril.m +++ b/scripts/general/tril.m @@ -1,29 +1,30 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = tril (x, k) -# usage: triu (x, k) -# -# Return the lower triangular part of x above the k-th diagonal. If -# the second argument is omitted, k = 0 is assumed. -# -# See also: triu, diag + ## usage: triu (x, k) + ## + ## Return the lower triangular part of x above the k-th diagonal. If + ## the second argument is omitted, k = 0 is assumed. + ## + ## See also: triu, diag if (nargin > 0) [nr, nc] = size (x);
--- a/scripts/general/triu.m +++ b/scripts/general/triu.m @@ -1,29 +1,30 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = triu (x, k) -# usage: triu (x, k) -# -# Return the upper triangular part of x above the k-th diagonal. If -# the second argument is omitted, k = 0 is assumed. -# -# See also: tril, diag + ## usage: triu (x, k) + ## + ## Return the upper triangular part of x above the k-th diagonal. If + ## the second argument is omitted, k = 0 is assumed. + ## + ## See also: tril, diag if (nargin > 0) [nr, nc] = size (x);
--- a/scripts/image/colormap.m +++ b/scripts/image/colormap.m @@ -1,36 +1,37 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function cmap = colormap (map) -# Set the current colormap. -# -# colormap (map) sets the current colormap to map. map should be an n -# row by 3 column matrix. The columns contain red, green, and blue -# intensities respectively. All entries should be between 0 and 1 -# inclusive. The new colormap is returned. -# -# colormap ("default") restores the default colormap (a gray scale -# colormap with 64 entries). The default colormap is returned. -# -# colormap with no arguments returns the current colormap. + ## Set the current colormap. + ## + ## colormap (map) sets the current colormap to map. map should be an n + ## row by 3 column matrix. The columns contain red, green, and blue + ## intensities respectively. All entries should be between 0 and 1 + ## inclusive. The new colormap is returned. + ## + ## colormap ("default") restores the default colormap (a gray scale + ## colormap with 64 entries). The default colormap is returned. + ## + ## colormap with no arguments returns the current colormap. -# Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994. + ## Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994. global CURRENT_COLOR_MAP @@ -46,15 +47,15 @@ error ("invalid argument"); endif else -# Set the new color map + ## Set the new color map CURRENT_COLOR_MAP = map; endif elseif (! exist ("CURRENT_COLOR_MAP")) -# If global color map doesn't exist, create the default map. + ## If global color map doesn't exist, create the default map. CURRENT_COLOR_MAP = gray; endif -# Return current color map. + ## Return current color map. cmap = CURRENT_COLOR_MAP;
--- a/scripts/image/gray.m +++ b/scripts/image/gray.m @@ -1,26 +1,27 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function map = gray (number) -# Colormap. + ## Colormap. -# Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994. + ## Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994. if (nargin == 0) number = 64;
--- a/scripts/image/gray2ind.m +++ b/scripts/image/gray2ind.m @@ -1,26 +1,27 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function [X, map] = gray2ind (I, n) -# Image format conversion + ## Image format conversion -# Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994. + ## Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994. if (nargin < 1 || nargin > 2) usage ("gray2ind (I, n)");
--- a/scripts/image/image.m +++ b/scripts/image/image.m @@ -1,37 +1,38 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function image (x, zoom) -# Display an octave image matrix. -# -# image (x) displays a matrix as a color image. The elements of x are -# indices into the current colormap and should have values between 1 -# and the length of the colormap. -# -# image (x, zoom) changes the zoom factor. The default value is 4. -# -# SEE ALSO: imshow, imagesc, colormap. + ## Display an octave image matrix. + ## + ## image (x) displays a matrix as a color image. The elements of x are + ## indices into the current colormap and should have values between 1 + ## and the length of the colormap. + ## + ## image (x, zoom) changes the zoom factor. The default value is 4. + ## + ## SEE ALSO: imshow, imagesc, colormap. -# Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994. + ## Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994. if (nargin == 0) -# Load Bobbie Jo Richardson (Born 3/16/94) + ## Load Bobbie Jo Richardson (Born 3/16/94) x = loadimage ("default.img"); zoom = 2; elseif (nargin == 1) @@ -40,14 +41,14 @@ usage ("image (matrix, [zoom])"); endif -# XXX FIXME XXX -- we should use octave_tmp_file_name. + ## XXX FIXME XXX -- we should use octave_tmp_file_name. rnd_str = num2str (fix (rand * 10000)); ppm_name = ["image.", rnd_str, ".ppm" ]; saveimage (ppm_name, x, "ppm"); -# Start the viewer. Try xv, then xloadimage. + ## Start the viewer. Try xv, then xloadimage. xv = sprintf ("xv -expand %f %s", zoom, ppm_name); xloadimage = sprintf ("xloadimage -zoom %f %s", zoom*100, ppm_name);
--- a/scripts/image/imagesc.m +++ b/scripts/image/imagesc.m @@ -1,34 +1,35 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function x = imagesc (x, zoom) -# Scale and display a matrix as an image. -# -# imagesc(x) displays a scaled version of the matrix x. The matrix is -# scaled so that its entries are indices into the current colormap. -# The scaled matrix is returned. -# -# imagesc (x, zoom) sets the magnification, the default value is 4. -# -# SEE ALSO: image, imshow + ## Scale and display a matrix as an image. + ## + ## imagesc(x) displays a scaled version of the matrix x. The matrix is + ## scaled so that its entries are indices into the current colormap. + ## The scaled matrix is returned. + ## + ## imagesc (x, zoom) sets the magnification, the default value is 4. + ## + ## SEE ALSO: image, imshow -# Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994. + ## Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994. if (nargin < 1 || nargin > 2) usage ("image (matrix, [zoom])"); @@ -41,13 +42,13 @@ maxval = max (max (x)); minval = min (min (x)); -# Rescale matrix so that all values are in the range 0 to -# length (colormap) inclusive. + ## Rescale matrix so that all values are in the range 0 to + ## length (colormap) inclusive. if (maxval == minval) x = ones (high, wide); else -# Rescale values to between 1 and length (colormap) inclusive. + ## Rescale values to between 1 and length (colormap) inclusive. x = fix ((x - minval) / (maxval - minval) * (length (colormap) - 1)) + 1; endif
--- a/scripts/image/imshow.m +++ b/scripts/image/imshow.m @@ -1,36 +1,37 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function imshow (a1, a2, a3) -# Display images. -# -# imshow (X) displays an indexed image using the current colormap. -# -# imshow (X, map) displays an indexed image using the specified colormap. -# -# imshow (I, n) displays a gray scale intensity image. -# -# imshow (R, G, B) displays an RGB image. -# -# SEE ALSO: image, imagesc, colormap, gray2ind, rgb2ind. + ## Display images. + ## + ## imshow (X) displays an indexed image using the current colormap. + ## + ## imshow (X, map) displays an indexed image using the specified colormap. + ## + ## imshow (I, n) displays a gray scale intensity image. + ## + ## imshow (R, G, B) displays an RGB image. + ## + ## SEE ALSO: image, imagesc, colormap, gray2ind, rgb2ind. -# Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994. + ## Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994. if (nargin < 0 || nargin > 3) usage ("imshow (args)");
--- a/scripts/image/ind2gray.m +++ b/scripts/image/ind2gray.m @@ -1,35 +1,36 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function Y = ind2gray (X, map) -# Convert an octave indexed image to a gray scale intensity image. -# -# Y = ind2gray (X) converts an indexed image to a gray scale intensity -# image. The current colormap is used to determine the intensities. -# The intensity values lie between 0 and 1 inclusive. -# -# Y = ind2gray (X, map) uses the specified colormap instead of the -# current one in the conversion process. -# -# SEE ALSO: gray2ind, rgb2ntsc, image, colormap + ## Convert an octave indexed image to a gray scale intensity image. + ## + ## Y = ind2gray (X) converts an indexed image to a gray scale intensity + ## image. The current colormap is used to determine the intensities. + ## The intensity values lie between 0 and 1 inclusive. + ## + ## Y = ind2gray (X, map) uses the specified colormap instead of the + ## current one in the conversion process. + ## + ## SEE ALSO: gray2ind, rgb2ntsc, image, colormap -# Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994. + ## Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994. if (nargin < 1 || nargin > 2) usage ("ind2gray (X, map)"); @@ -37,13 +38,13 @@ map = colormap (); endif -# Convert colormap to intensity values. + ## Convert colormap to intensity values. yiq = rgb2ntsc (map); y = yiq(:,1); -# We need Fortran indexing capability, but be sure to save the user's -# preference. + ## We need Fortran indexing capability, but be sure to save the user's + ## preference. pref = do_fortran_indexing; @@ -51,8 +52,8 @@ do_fortran_indexing = "true"; -# Replace indices in the input matrix with indexed values in the output -# matrix. + ## Replace indices in the input matrix with indexed values in the output + ## matrix. [rows, cols] = size (X); Y = y(X(:));
--- a/scripts/image/ind2rgb.m +++ b/scripts/image/ind2rgb.m @@ -1,32 +1,33 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function [R, G, B] = ind2rgb (X, map) -# Convert an indexed image to red, green, and blue color components. -# -# [R G B] = ind2rgb(X) uses the current colormap for the conversion. -# -# [R G B] = ind2rgb(X,map) uses the specified colormap. -# -# SEE ALSO: rgb2ind, image, imshow, ind2gray, gray2ind. + ## Convert an indexed image to red, green, and blue color components. + ## + ## [R G B] = ind2rgb(X) uses the current colormap for the conversion. + ## + ## [R G B] = ind2rgb(X,map) uses the specified colormap. + ## + ## SEE ALSO: rgb2ind, image, imshow, ind2gray, gray2ind. -# Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994. + ## Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994. if (nargin < 1 || nargin > 2) usage ("ind2rgb (X, map)"); @@ -36,7 +37,7 @@ [hi, wi] = size (X); -# XXX FIXME XXX -- we should check size of X and map. + ## XXX FIXME XXX -- we should check size of X and map. pref = do_fortran_indexing;
--- a/scripts/image/loadimage.m +++ b/scripts/image/loadimage.m @@ -1,32 +1,33 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function [X, map] = loadimage (filename) -# Load an image file. -# -# [X, map] = loadimage (img_file) loads an image and it's associated -# color map from file img_file. The image must be in stored in -# octave's image format. -# -# SEE ALSO: saveimage, load, save + ## Load an image file. + ## + ## [X, map] = loadimage (img_file) loads an image and it's associated + ## color map from file img_file. The image must be in stored in + ## octave's image format. + ## + ## SEE ALSO: saveimage, load, save -# Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994. + ## Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994. if (nargin != 1) usage ("loadimage (filename)"); @@ -40,7 +41,7 @@ error ("loadimage: unable to find image file"); endif -# XXX FIXME XXX -- file is assumed to have variables X and map. + ## XXX FIXME XXX -- file is assumed to have variables X and map. eval (['load ', file]);
--- a/scripts/image/ntsc2rgb.m +++ b/scripts/image/ntsc2rgb.m @@ -1,26 +1,27 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function rgb = ntsc2rgb (yiq) -# Image format conversion. + ## Image format conversion. -# Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994. + ## Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994. if (nargin != 1) usage ("ntsc2rgb (yiq)");
--- a/scripts/image/ocean.m +++ b/scripts/image/ocean.m @@ -1,26 +1,27 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function map = ocean (number) -# Colormap. + ## Colormap. -# Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994. + ## Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994. if (nargin == 0) number = 64;
--- a/scripts/image/rgb2ind.m +++ b/scripts/image/rgb2ind.m @@ -1,32 +1,33 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function [X, map] = rgb2ind (R, G, B) -# Convert and RGB image to an octave indexed image. -# -# [X, map] = rgb2ind (R, G, B) -# -# SEE ALSO: ind2rgb, rgb2ntsc. -# -# Bugs: The color map may have duplicate entries. + ## Convert and RGB image to an octave indexed image. + ## + ## [X, map] = rgb2ind (R, G, B) + ## + ## SEE ALSO: ind2rgb, rgb2ntsc. + ## + ## Bugs: The color map may have duplicate entries. -# Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994. + ## Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994. if (nargin != 3) usage ("[X, map] = rgb2ind (R, G, B)");
--- a/scripts/image/rgb2ntsc.m +++ b/scripts/image/rgb2ntsc.m @@ -1,26 +1,27 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function yiq = rgb2ntsc (rgb) -# Image format conversion. + ## Image format conversion. -# Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994. + ## Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994. if (nargin != 1) usage ("rgb2ntsc (rgb)");
--- a/scripts/image/saveimage.m +++ b/scripts/image/saveimage.m @@ -1,75 +1,76 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function saveimage (filename, img, img_form, map) -# Save a matrix to disk in image format. -# -# saveimage (filename, x) saves matrix x to file filename in octave's -# image format. The current colormap is saved in the file also. -# -# saveimage (filename, x, "img") saves the image in the default format -# and is the same as saveimage (filename, x). -# -# saveimage (filename, x, "ppm") saves the image in ppm format instead -# of the default octave image format. -# -# saveimage (filename, x, "ps") saves the image in PostScript format -# instead of the default octave image format. (Note: images saved in -# PostScript format can not be read back into octave with loadimage.) -# -# saveimage (filename, x, format, map) saves the image along with the -# specified colormap in the specified format. -# -# Note: If the colormap contains only two entries and these entries -# are black and white, the bitmap ppm and PostScript formats are used. -# If the image is a gray scale image (the entries within each row of -# the colormap are equal) the gray scale ppm and PostScript image -# formats are used, otherwise the full color formats are used. -# -# The conversion to PostScript is based on pbmtolps.c, which was -# written by -# -# George Phillips <phillips@cs.ubc.ca> -# Department of Computer Science -# University of British Columbia -# -# and is part of the portable bitmap utilities, -# -# SEE ALSO: loadimage, save, load, colormap + ## Save a matrix to disk in image format. + ## + ## saveimage (filename, x) saves matrix x to file filename in octave's + ## image format. The current colormap is saved in the file also. + ## + ## saveimage (filename, x, "img") saves the image in the default format + ## and is the same as saveimage (filename, x). + ## + ## saveimage (filename, x, "ppm") saves the image in ppm format instead + ## of the default octave image format. + ## + ## saveimage (filename, x, "ps") saves the image in PostScript format + ## instead of the default octave image format. (Note: images saved in + ## PostScript format can not be read back into octave with loadimage.) + ## + ## saveimage (filename, x, format, map) saves the image along with the + ## specified colormap in the specified format. + ## + ## Note: If the colormap contains only two entries and these entries + ## are black and white, the bitmap ppm and PostScript formats are used. + ## If the image is a gray scale image (the entries within each row of + ## the colormap are equal) the gray scale ppm and PostScript image + ## formats are used, otherwise the full color formats are used. + ## + ## The conversion to PostScript is based on pbmtolps.c, which was + ## written by + ## + ## George Phillips <phillips@cs.ubc.ca> + ## Department of Computer Science + ## University of British Columbia + ## + ## and is part of the portable bitmap utilities, + ## + ## SEE ALSO: loadimage, save, load, colormap -# Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994. + ## Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994. -# Rewritten by jwe to avoid using octoppm and pbm routines so that -# people who don't have the the pbm stuff installed can still use this -# function. -# -# The conversion to PostScript is based on pnmtops.c, which is part of -# the portable bitmap utilties and bears this copyright notice: -# -# Copyright (C) 1989 by Jef Poskanzer. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose and without fee is hereby granted, provided -# that the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation. This software is provided "as is" without express or -# implied warranty. + ## Rewritten by jwe to avoid using octoppm and pbm routines so that + ## people who don't have the the pbm stuff installed can still use this + ## function. + ## + ## The conversion to PostScript is based on pnmtops.c, which is part of + ## the portable bitmap utilties and bears this copyright notice: + ## + ## Copyright (C) 1989 by Jef Poskanzer. + ## + ## Permission to use, copy, modify, and distribute this software and its + ## documentation for any purpose and without fee is hereby granted, provided + ## that the above copyright notice appear in all copies and that both that + ## copyright notice and this permission notice appear in supporting + ## documentation. This software is provided "as is" without express or + ## implied warranty. if (nargin < 2 || nargin > 4) usage ("saveimage (filename, matrix, [format, [colormap]])"); @@ -103,14 +104,14 @@ error ("file name must be a string"); endif -# If we just want Octave image format, save and return. + ## If we just want Octave image format, save and return. if (strcmp (img_form, "img")) eval (strcat ("save -ascii ", filename, " map img")); return; endif -# Convert to another format if requested. + ## Convert to another format if requested. grey = all (map(:,1) == map(:,2) && map(:,1) == map (:,3)); @@ -226,8 +227,8 @@ devpix = dpi / 72.0 + 0.5; pixfac = 72.0 / dpi * devpix; -# Compute padding to round cols * bps up to the nearest multiple of 8 -# (nr and nc are switched because we transposed the image above). + ## Compute padding to round cols * bps up to the nearest multiple of 8 + ## (nr and nc are switched because we transposed the image above). padright = (((img_nr * bps + 7) / 8) * 8 - img_nr * bps) / bps; @@ -279,8 +280,8 @@ img = map(img); -# XXX FIXME XXX -- this would be much faster if fprintf knew about -# vector arguments. + ## XXX FIXME XXX -- this would be much faster if fprintf knew about + ## vector arguments. count = 0; for i = 1:img_sz
--- a/scripts/io/printf.m +++ b/scripts/io/printf.m @@ -1,28 +1,29 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = printf (fmt, ...) -# usage: printf (fmt, ...) -# -# Formatted write to standard output. -# -# See also: fprintf sprintf + ## usage: printf (fmt, ...) + ## + ## Formatted write to standard output. + ## + ## See also: fprintf sprintf retval = -1;
--- a/scripts/io/puts.m +++ b/scripts/io/puts.m @@ -1,28 +1,29 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = puts (s) -# usage: puts (string) -# -# Write string to the standard output. -# -# See also: fputs, printf, fprintf + ## usage: puts (string) + ## + ## Write string to the standard output. + ## + ## See also: fputs, printf, fprintf retval = -1;
--- a/scripts/linear-algebra/cond.m +++ b/scripts/linear-algebra/cond.m @@ -1,29 +1,30 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = cond (a) -# usage: cond (a) -# -# Return the condition number of a, computed using the singular values -# of a. -# -# See also: norm, svd + ## usage: cond (a) + ## + ## Return the condition number of a, computed using the singular values + ## of a. + ## + ## See also: norm, svd if (nargin == 1) [nr, nc] = size (a);
--- a/scripts/linear-algebra/kron.m +++ b/scripts/linear-algebra/kron.m @@ -1,38 +1,39 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function x = kron (a, b) -# Usage: x = kron (a, b) -# -# Form the Kronecker product of two matrices, defined block by block -# as -# -# x = [a(i,j) b] + ## Usage: x = kron (a, b) + ## + ## Form the Kronecker product of two matrices, defined block by block + ## as + ## + ## x = [a(i,j) b] -# Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993. + ## Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993. if (nargin == 2) [m, n] = size (b); [ma, na] = size (a); -# Do 1st column. + ## Do 1st column. x = a (1, 1) * b; for ii = 2:ma @@ -40,7 +41,7 @@ x = [x; tmp]; endfor -# Do remaining columns. + ## Do remaining columns. for jj = 2:na tmp = a (1, jj) * b;
--- a/scripts/linear-algebra/norm.m +++ b/scripts/linear-algebra/norm.m @@ -1,48 +1,49 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = norm (x, p) -# usage: norm (x, p) -# -# Compute the p-norm of x. -# -# If x is a matrix: -# -# value of p norm returns -# ---------- ------------ -# 1 1-norm, the largest column sum of x -# 2 largest singular value of x -# Inf infinity norm, the largest row sum of x -# "inf" same as Inf -# "fro" Frobenius norm of x, sqrt (sum (diag (x' * x))) -# -# If x is a vector or a scalar: -# -# value of p norm returns -# ---------- ------------ -# Inf max (abs (x)) -# -Inf min (abs (x)) -# other p-norm of x, sum (abs (x) .^ p) ^ (1/p) -# -# If the second argument is missing, p = 2 is assumed. -# -# See also: cond, svd + ## usage: norm (x, p) + ## + ## Compute the p-norm of x. + ## + ## If x is a matrix: + ## + ## value of p norm returns + ## ---------- ------------ + ## 1 1-norm, the largest column sum of x + ## 2 largest singular value of x + ## Inf infinity norm, the largest row sum of x + ## "inf" same as Inf + ## "fro" Frobenius norm of x, sqrt (sum (diag (x' * x))) + ## + ## If x is a vector or a scalar: + ## + ## value of p norm returns + ## ---------- ------------ + ## Inf max (abs (x)) + ## -Inf min (abs (x)) + ## other p-norm of x, sum (abs (x) .^ p) ^ (1/p) + ## + ## If the second argument is missing, p = 2 is assumed. + ## + ## See also: cond, svd if (nargin < 1 || nargin > 2) error ("usage: norm (x [, p])"); @@ -53,7 +54,7 @@ return; endif -# Do we have a vector or matrix as the first argument? + ## Do we have a vector or matrix as the first argument? if (rows (x) == 1 || columns (x) == 1)
--- a/scripts/linear-algebra/null.m +++ b/scripts/linear-algebra/null.m @@ -1,34 +1,35 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = null (A, tol) -# usage: null (A, tol) -# null (A) -# -# Returns an orthonormal basis of the null space of A. -# -# The dimension of the null space is taken as the number of singular -# values of A not greater than tol; the default for tol is -# max (size (A)) * sigma_max (A) * eps, where sigma_max (A) is the -# maximal singular value of A. + ## usage: null (A, tol) + ## null (A) + ## + ## Returns an orthonormal basis of the null space of A. + ## + ## The dimension of the null space is taken as the number of singular + ## values of A not greater than tol; the default for tol is + ## max (size (A)) * sigma_max (A) * eps, where sigma_max (A) is the + ## maximal singular value of A. -# Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Dec 24, 1993. + ## Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Dec 24, 1993. [U, S, V] = svd (A);
--- a/scripts/linear-algebra/orth.m +++ b/scripts/linear-algebra/orth.m @@ -1,34 +1,35 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = orth (A, tol) -# usage: orth (A, tol) -# orth (A) -# -# Returns an orthonormal basis of the range of A. -# -# The dimension of the range space is taken as the number of singular -# values of A greater than tol; the default for tol is -# max (size (A)) * sigma_max (A) * eps, where sigma_max (A) is the -# maximal singular value of A. + ## usage: orth (A, tol) + ## orth (A) + ## + ## Returns an orthonormal basis of the range of A. + ## + ## The dimension of the range space is taken as the number of singular + ## values of A greater than tol; the default for tol is + ## max (size (A)) * sigma_max (A) * eps, where sigma_max (A) is the + ## maximal singular value of A. -# Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Dec 24, 1993. + ## Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Dec 24, 1993. [U, S, V] = svd (A);
--- a/scripts/linear-algebra/qzhess.m +++ b/scripts/linear-algebra/qzhess.m @@ -1,37 +1,38 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function [aa, bb, q, z] = qzhess (a, b) -# Usage: [aa, bb, q, z] = qzhess (a, b) -# -# Compute the qz decomposition of the matrix pencil (a - lambda b) -# -# result: (for Matlab compatibility): -# -# aa = q*a*z and bb = q*b*z, with q, z orthogonal, and -# v = matrix of generalized eigenvectors. -# -# This ought to be done in a compiled program -# -# Algorithm taken from Golub and Van Loan, Matrix Computations, 2nd ed. + ## Usage: [aa, bb, q, z] = qzhess (a, b) + ## + ## Compute the qz decomposition of the matrix pencil (a - lambda b) + ## + ## result: (for Matlab compatibility): + ## + ## aa = q*a*z and bb = q*b*z, with q, z orthogonal, and + ## v = matrix of generalized eigenvectors. + ## + ## This ought to be done in a compiled program + ## + ## Algorithm taken from Golub and Van Loan, Matrix Computations, 2nd ed. -# Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993. + ## Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993. if (nargin != 2) error ("usage: [aa, bb, q, z] = qzhess (a, b)"); @@ -43,7 +44,7 @@ error ("qzhess: incompatible dimensions"); endif -# Reduce to hessenberg-triangular form. + ## Reduce to hessenberg-triangular form. [q, bb] = qr (b); aa = q' * a; @@ -52,14 +53,14 @@ for j = 1:(na-2) for i = na:-1:(j+2) -# disp (["zero out aa(", num2str(i), ",", num2str(j), ")"]) + ## disp (["zero out aa(", num2str(i), ",", num2str(j), ")"]) rot = givens (aa (i-1, j), aa (i, j)); aa ((i-1):i, :) = rot *aa ((i-1):i, :); bb ((i-1):i, :) = rot *bb ((i-1):i, :); q ((i-1):i, :) = rot *q ((i-1):i, :); -# disp (["now zero out bb(", num2str(i), ",", num2str(i-1), ")"]) + ## disp (["now zero out bb(", num2str(i), ",", num2str(i-1), ")"]) rot = givens (bb (i, i), bb (i, i-1))'; bb (:, (i-1):i) = bb (:, (i-1):i) * rot';
--- a/scripts/linear-algebra/rank.m +++ b/scripts/linear-algebra/rank.m @@ -1,34 +1,35 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = rank (A, tol) -# usage: rank (a, tol) -# -# Return the rank of the matrix a. The rank is taken to be the number -# of singular values of a that are greater than tol. -# -# If the second argument is omitted, it is taken to be -# -# tol = max (size (a)) * sigma (1) * eps; -# -# where eps is machine precision and sigma is the largest singular -# value of a. + ## usage: rank (a, tol) + ## + ## Return the rank of the matrix a. The rank is taken to be the number + ## of singular values of a that are greater than tol. + ## + ## If the second argument is omitted, it is taken to be + ## + ## tol = max (size (a)) * sigma (1) * eps; + ## + ## where eps is machine precision and sigma is the largest singular + ## value of a. if (nargin == 1) sigma = svd (A);
--- a/scripts/linear-algebra/trace.m +++ b/scripts/linear-algebra/trace.m @@ -1,26 +1,27 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function y = trace (x) -# usage: trace (x) -# -# Returns the trace (the sum of the diagonal elements) of x. + ## usage: trace (x) + ## + ## Returns the trace (the sum of the diagonal elements) of x. if (nargin != 1) usage ("trace (x)");
--- a/scripts/miscellaneous/bug_report.m +++ b/scripts/miscellaneous/bug_report.m @@ -1,28 +1,29 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function bug_report () -# usage: bug_report -# -# Have Octave create a bug report template file, invoke your favorite -# editor, and submit the report to the bug-octave mailing list when -# you are finished editing. + ## usage: bug_report + ## + ## Have Octave create a bug report template file, invoke your favorite + ## editor, and submit the report to the bug-octave mailing list when + ## you are finished editing. if (nargin != 0) warning ("bug_report: ignoring extra arguments"); @@ -34,8 +35,8 @@ subject = ""; subject = input ("Subject: ", "s"); -# XXX FIXME XXX -- really need a better system command, one that will -# automatically send output from the command to stdout... + ## XXX FIXME XXX -- really need a better system command, one that will + ## automatically send output from the command to stdout... prefs = octave_tmp_file_name ();
--- a/scripts/miscellaneous/comma.m +++ b/scripts/miscellaneous/comma.m @@ -1,21 +1,22 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. -# Array index, function argument, or command separator. -# -# See also: semicolon +## Array index, function argument, or command separator. +## +## See also: semicolon
--- a/scripts/miscellaneous/cputime.m +++ b/scripts/miscellaneous/cputime.m @@ -1,26 +1,27 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function [total, user, system] = cputime () -# usage: cputime -# -# Get CPU time statistics. + ## usage: cputime + ## + ## Get CPU time statistics. if (nargin != 0) warning ("cputime: ignoring extra arguments");
--- a/scripts/miscellaneous/dump_1_pref.m +++ b/scripts/miscellaneous/dump_1_pref.m @@ -1,20 +1,21 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function dump_1_pref (file, var)
--- a/scripts/miscellaneous/dump_prefs.m +++ b/scripts/miscellaneous/dump_prefs.m @@ -1,37 +1,38 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function dump_prefs (file) -# usage: dump_prefs (file) -# -# Have Octave dump all the current user preference variables to FILE -# in a format that can be parsed by Octave later. If FILE is omitted, -# the listing is printed to stdout. + ## usage: dump_prefs (file) + ## + ## Have Octave dump all the current user preference variables to FILE + ## in a format that can be parsed by Octave later. If FILE is omitted, + ## the listing is printed to stdout. if (nargin == 0) file = stdout; endif -# XXX FIXME XXX -- vectors of strings would be really useful here... -# XXX FIXME XXX -- maybe this should be a built-in function so that we -# wouldn't have to remember to update it each time the list of -# preference variables changes + ## XXX FIXME XXX -- vectors of strings would be really useful here... + ## XXX FIXME XXX -- maybe this should be a built-in function so that we + ## wouldn't have to remember to update it each time the list of + ## preference variables changes dump_1_pref (file, "EDITOR"); dump_1_pref (file, "IMAGEPATH");
--- a/scripts/miscellaneous/etime.m +++ b/scripts/miscellaneous/etime.m @@ -1,29 +1,30 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function secs = etime (t1, t0) -# usage: etime (t1, t0) -# -# Return the difference between t1 and t0 in seconds. The arguments -# are expected to be vectors in the form returned by clock (). -# -# See also: tic, toc, clock, cputime + ## usage: etime (t1, t0) + ## + ## Return the difference between t1 and t0 in seconds. The arguments + ## are expected to be vectors in the form returned by clock (). + ## + ## See also: tic, toc, clock, cputime if (nargin != 2) usage ("etime (t1, t0)"); @@ -35,8 +36,8 @@ error ("etime: can't handle timings over year boundaries yet"); endif -# XXX FIXME XXX -- could check here to ensure that t1 and t0 really do -# make sense as vectors returned from clock(). + ## XXX FIXME XXX -- could check here to ensure that t1 and t0 really do + ## make sense as vectors returned from clock(). days_in_months = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
--- a/scripts/miscellaneous/flops.m +++ b/scripts/miscellaneous/flops.m @@ -1,26 +1,27 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = flops () -# usage: flops -# -# Count floating point operations. + ## usage: flops + ## + ## Count floating point operations. if (nargin > 0) usage ("flops ()");
--- a/scripts/miscellaneous/is_leap_year.m +++ b/scripts/miscellaneous/is_leap_year.m @@ -1,27 +1,28 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = is_leap_year (year) -# usage: is_leap_year (year) -# -# Return 1 if the given year is a leap year; otherwise, return 0. -# With no arguments, use the current year. + ## usage: is_leap_year (year) + ## + ## Return 1 if the given year is a leap year; otherwise, return 0. + ## With no arguments, use the current year. if (nargin > 1) usage ("is_leap_year (year)");
--- a/scripts/miscellaneous/list_primes.m +++ b/scripts/miscellaneous/list_primes.m @@ -1,29 +1,30 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = list_primes (n) -# usage: list_primes (n) -# -# List the first n primes. If n is unspecified, the first 30 primes -# are listed. -# -# The algorithm used is from page 218 of the TeXbook. + ## usage: list_primes (n) + ## + ## List the first n primes. If n is unspecified, the first 30 primes + ## are listed. + ## + ## The algorithm used is from page 218 of the TeXbook. if (nargin > 0) if (! is_scalar (n))
--- a/scripts/miscellaneous/menu.m +++ b/scripts/miscellaneous/menu.m @@ -1,37 +1,38 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function num = menu (t, ...) -# usage: menu (title, opt1, ...) -# -# See also: disp, printf, input + ## usage: menu (title, opt1, ...) + ## + ## See also: disp, printf, input if (nargin < 2) usage ("menu (title, opt1, ...)"); endif -# Force pending output to appear before the menu. + ## Force pending output to appear before the menu. fflush (stdout); -# Don't send the menu through the pager since doing that can cause -# major confusion. + ## Don't send the menu through the pager since doing that can cause + ## major confusion. save_page_screen_output = page_screen_output;
--- a/scripts/miscellaneous/popen2.m +++ b/scripts/miscellaneous/popen2.m @@ -1,43 +1,44 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function [in, out, pid] = popen2 (command, args) -# usage: [IN, OUT, PID] = popen2 (COMMAND, ARGS) -# -# Start a subprocess with two-way communication. COMMAND specifies -# the name of the command to start. ARGS is an array of strings -# containing options for COMMAND. IN and out are the file ids of the -# input and streams for the subprocess, and PID is the process id of -# the subprocess, or -1 if COMMAND could not be executed. -# -# Example: -# -# [in, out, pid] = popen2 ("sort", "-nr"); -# fputs (in, "these\n"); -# fputs (in, "are\n"); -# fputs (in, "some\n"); -# fputs (in, "strings\n"); -# fclose (in); -# while (isstr (s = fgets (out))) -# fputs (stdout, s); -# endwhile -# fclose (out); + ## usage: [IN, OUT, PID] = popen2 (COMMAND, ARGS) + ## + ## Start a subprocess with two-way communication. COMMAND specifies + ## the name of the command to start. ARGS is an array of strings + ## containing options for COMMAND. IN and out are the file ids of the + ## input and streams for the subprocess, and PID is the process id of + ## the subprocess, or -1 if COMMAND could not be executed. + ## + ## Example: + ## + ## [in, out, pid] = popen2 ("sort", "-nr"); + ## fputs (in, "these\n"); + ## fputs (in, "are\n"); + ## fputs (in, "some\n"); + ## fputs (in, "strings\n"); + ## fclose (in); + ## while (isstr (s = fgets (out))) + ## fputs (stdout, s); + ## endwhile + ## fclose (out); in = -1; out = -1;
--- a/scripts/miscellaneous/semicolon.m +++ b/scripts/miscellaneous/semicolon.m @@ -1,21 +1,22 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. -# Array row or command separator. -# -# See also: comma +## Array row or command separator. +## +## See also: comma
--- a/scripts/miscellaneous/texas_lotto.m +++ b/scripts/miscellaneous/texas_lotto.m @@ -1,29 +1,30 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function picks = texas_lotto () -# usage: texas_lotto -# -# Pick 6 unique numbers between 1 and 50 that are guaranteed to win -# the Texas Lotto. -# -# See also: rand + ## usage: texas_lotto + ## + ## Pick 6 unique numbers between 1 and 50 that are guaranteed to win + ## the Texas Lotto. + ## + ## See also: rand if (nargin != 0) warning ("win_texas_lotto: ignoring extra arguments");
--- a/scripts/miscellaneous/tic.m +++ b/scripts/miscellaneous/tic.m @@ -1,28 +1,29 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function tic () -# usage: tic -# -# Set a wall-clock timer. -# -# See also: toc, clock, etime, cputime + ## usage: tic + ## + ## Set a wall-clock timer. + ## + ## See also: toc, clock, etime, cputime if (nargin != 0) warning ("tic: ignoring extra arguments");
--- a/scripts/miscellaneous/toc.m +++ b/scripts/miscellaneous/toc.m @@ -1,29 +1,30 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function secs = toc () -# usage: toc -# -# Return the difference between the current wall-clock time and the -# time that the function tic () was last called, in seconds. -# -# See also: tic, clock, etime, cputime + ## usage: toc + ## + ## Return the difference between the current wall-clock time and the + ## time that the function tic () was last called, in seconds. + ## + ## See also: tic, clock, etime, cputime if (nargin != 0) warning ("toc: ignoring extra arguments");
--- a/scripts/miscellaneous/version.m +++ b/scripts/miscellaneous/version.m @@ -1,28 +1,29 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function vs = version () -# usage: version -# -# Return the Octave version number as a string. -# -# See also: OCTAVE_VERSION + ## usage: version + ## + ## Return the Octave version number as a string. + ## + ## See also: OCTAVE_VERSION if (nargin != 0) warning ("version: ignoring extra arguments");
--- a/scripts/plot/__plr1__.m +++ b/scripts/plot/__plr1__.m @@ -1,20 +1,21 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function polar_int_1 (theta, fmt)
--- a/scripts/plot/__plr2__.m +++ b/scripts/plot/__plr2__.m @@ -1,20 +1,21 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function polar_int_2 (theta, rho, fmt)
--- a/scripts/plot/__plr__.m +++ b/scripts/plot/__plr__.m @@ -1,20 +1,21 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function polar_int (theta, rho, fmt)
--- a/scripts/plot/__plt1__.m +++ b/scripts/plot/__plt1__.m @@ -1,20 +1,21 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function plot_int_1 (x1, fmt)
--- a/scripts/plot/__plt2__.m +++ b/scripts/plot/__plt2__.m @@ -1,20 +1,21 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function plot_int_2 (x1, x2, fmt)
--- a/scripts/plot/__plt2mm__.m +++ b/scripts/plot/__plt2mm__.m @@ -1,20 +1,21 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function plot_2_m_m (x, y, fmt)
--- a/scripts/plot/__plt2mv__.m +++ b/scripts/plot/__plt2mv__.m @@ -1,20 +1,21 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function plot_2_m_v (x, y, fmt)
--- a/scripts/plot/__plt2ss__.m +++ b/scripts/plot/__plt2ss__.m @@ -1,20 +1,21 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function plot_2_s_s (x, y, fmt)
--- a/scripts/plot/__plt2vm__.m +++ b/scripts/plot/__plt2vm__.m @@ -1,20 +1,21 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function plot_2_v_m (x, y, fmt)
--- a/scripts/plot/__plt2vv__.m +++ b/scripts/plot/__plt2vv__.m @@ -1,20 +1,21 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function plot_2_v_v (x, y, fmt)
--- a/scripts/plot/__plt__.m +++ b/scripts/plot/__plt__.m @@ -1,20 +1,21 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function plot_int (caller, ...) @@ -34,7 +35,7 @@ x_set = 1; y_set = 0; -# Gather arguments, decode format, and plot lines. + ## Gather arguments, decode format, and plot lines. while (nargin-- > 0) @@ -71,7 +72,7 @@ endwhile -# Handle last plot. + ## Handle last plot. if (x_set) if (y_set)
--- a/scripts/plot/__pltopt__.m +++ b/scripts/plot/__pltopt__.m @@ -1,65 +1,66 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. -# Originally written by Rick Niles <niles@axp745.gsfc.nasa.gov>. +## Originally written by Rick Niles <niles@axp745.gsfc.nasa.gov>. function fmt = plot_opt (caller, opt) -# usage: fmt = plot_opt (caller, opt) -# -# Decode plot option strings. -# -# If OPT is a valid option string, return a string of the form "w l 2" -# ("with lines 2"). Uses abbreviations for the options to avoid -# overrunning gnuplot's command line buffer unnecessarily. -# -# OPT can currently be some combination of the following: -# -# "-" for lines plot style (default). -# "." for dots plot style. -# "@" for points plot style. -# "-@" for linespoints plot style. -# "^" for impulses plot style. -# "L" for steps plot style. -# "#" for boxes plot style. -# "~" for errorbars plot style. -# "#~" for boxerrorbars plot style. -# "n" with n in 1-6 (wraps at 8), plot color -# "nm" with m in 1-6 (wraps at 6), point style (only valid with "@" or "-@") -# "c" where c is one of ["r", "g", "b", "m", "c", "w"] colors. -# -# Special points formats: -# -# "+", "*", "o", "x" will display points in that style. -# -# The legend may be fixed to include the name of the variable -# plotted in some future version of Octave. -# -# The color line styles have the following meanings on terminals -# that support color. -# -# Number Gnuplot colors (lines)points style -# 1 red "*" -# 2 green "+" -# 3 blue "o" -# 4 magenta "x" -# 5 cyan house -# 6 brown there exists + ## usage: fmt = plot_opt (caller, opt) + ## + ## Decode plot option strings. + ## + ## If OPT is a valid option string, return a string of the form "w l 2" + ## ("with lines 2"). Uses abbreviations for the options to avoid + ## overrunning gnuplot's command line buffer unnecessarily. + ## + ## OPT can currently be some combination of the following: + ## + ## "-" for lines plot style (default). + ## "." for dots plot style. + ## "@" for points plot style. + ## "-@" for linespoints plot style. + ## "^" for impulses plot style. + ## "L" for steps plot style. + ## "#" for boxes plot style. + ## "~" for errorbars plot style. + ## "#~" for boxerrorbars plot style. + ## "n" with n in 1-6 (wraps at 8), plot color + ## "nm" with m in 1-6 (wraps at 6), point style (only valid with "@" or "-@") + ## "c" where c is one of ["r", "g", "b", "m", "c", "w"] colors. + ## + ## Special points formats: + ## + ## "+", "*", "o", "x" will display points in that style. + ## + ## The legend may be fixed to include the name of the variable + ## plotted in some future version of Octave. + ## + ## The color line styles have the following meanings on terminals + ## that support color. + ## + ## Number Gnuplot colors (lines)points style + ## 1 red "*" + ## 2 green "+" + ## 3 blue "o" + ## 4 magenta "x" + ## 5 cyan house + ## 6 brown there exists set_color = 0; set_symbol = 0; @@ -93,7 +94,7 @@ while (more_opts) -# First get next char. + ## First get next char. if (max (size (opt)) > 1) [char, opt] = sscanf (opt, "%c %s", "C"); @@ -102,7 +103,7 @@ more_opts = 0; endif -# Now set flags based on char. + ## Now set flags based on char. if (strcmp (char, "-")) set_lines = 1; @@ -170,7 +171,7 @@ endif endwhile -# Now create format string. + ## Now create format string. fmt = WITH;
--- a/scripts/plot/axis.m +++ b/scripts/plot/axis.m @@ -1,37 +1,38 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function curr_axis = axis (ax) -# usage: axis () -# axis ([xmin, xmax]) -# axis ([xmin, xmax, ymin, ymax]) -# axis ([xmin, xmax, ymin, ymax, zmin, zmax]) -# -# Sets the axis limits. -# -# With no arguments, turns autoscaling on. -# -# If your plot is already drawn, then you need to REPLOT before -# the new axis limits will take effect. + ## usage: axis () + ## axis ([xmin, xmax]) + ## axis ([xmin, xmax, ymin, ymax]) + ## axis ([xmin, xmax, ymin, ymax, zmin, zmax]) + ## + ## Sets the axis limits. + ## + ## With no arguments, turns autoscaling on. + ## + ## If your plot is already drawn, then you need to REPLOT before + ## the new axis limits will take effect. -# This may not be correct if someone has used the gnuplot interface -# directly... + ## This may not be correct if someone has used the gnuplot interface + ## directly... global __current_axis__;
--- a/scripts/plot/bar.m +++ b/scripts/plot/bar.m @@ -1,44 +1,45 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function [xb, yb] = bar (x, y) -# usage: [xb, yb] = bar (x, y) -# -# Given two vectors of x-y data, bar produces a `bar' graph. -# -# If only one argument is given, it is taken as a vector of y-values -# and the x coordinates are taken to be the indices of the elements. -# -# If two output arguments are specified, the data are generated but -# not plotted. For example, -# -# bar (x, y); -# -# and -# -# [xb, yb] = bar (x, y); -# plot (xb, yb); -# -# are equivalent. -# -# See also: plot, semilogx, semilogy, loglog, polar, mesh, contour, -# stairs, gplot, gsplot, replot, xlabel, ylabel, title + ## usage: [xb, yb] = bar (x, y) + ## + ## Given two vectors of x-y data, bar produces a `bar' graph. + ## + ## If only one argument is given, it is taken as a vector of y-values + ## and the x coordinates are taken to be the indices of the elements. + ## + ## If two output arguments are specified, the data are generated but + ## not plotted. For example, + ## + ## bar (x, y); + ## + ## and + ## + ## [xb, yb] = bar (x, y); + ## plot (xb, yb); + ## + ## are equivalent. + ## + ## See also: plot, semilogx, semilogy, loglog, polar, mesh, contour, + ## stairs, gplot, gsplot, replot, xlabel, ylabel, title if (nargin == 1) if (is_vector (x))
--- a/scripts/plot/bottom_title.m +++ b/scripts/plot/bottom_title.m @@ -1,34 +1,34 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function bottom_title (text) -# usage: bottom_title (text) -# -# NOTE: this will work only with gnuplot installed with -# multiplot patch -# -# makes a title with the given text at the bottom of the plot -# rather than the top. -# + ## usage: bottom_title (text) + ## + ## NOTE: this will work only with gnuplot installed with + ## multiplot patch + ## + ## makes a title with the given text at the bottom of the plot + ## rather than the top. + ## -# Written by Vinayak Dutt, Dutt.Vinayak@mayo.EDU + ## Written by Vinayak Dutt, Dutt.Vinayak@mayo.EDU if (! gnuplot_has_multiplot) error ("bottom_title: gnuplot does not appear to support this feature");
--- a/scripts/plot/contour.m +++ b/scripts/plot/contour.m @@ -1,27 +1,28 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function contour (z, n, x, y) -# usage: contour (z, n, x, y) -# -# See also: plot, semilogx, semilogy, loglog, polar, mesh, contour, -# bar, stairs, gplot, gsplot, replot, xlabel, ylabel, title + ## usage: contour (z, n, x, y) + ## + ## See also: plot, semilogx, semilogy, loglog, polar, mesh, contour, + ## bar, stairs, gplot, gsplot, replot, xlabel, ylabel, title if (nargin == 1)
--- a/scripts/plot/figure.m +++ b/scripts/plot/figure.m @@ -1,27 +1,28 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function figure (n) -# usage: figure (n) -# -# Set the current plot window to plot window N. This function -# currently requires X11 and a recent version of gnuplot. + ## usage: figure (n) + ## + ## Set the current plot window to plot window N. This function + ## currently requires X11 and a recent version of gnuplot. if (nargin == 1) if (gnuplot_has_frames)
--- a/scripts/plot/grid.m +++ b/scripts/plot/grid.m @@ -1,31 +1,32 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function grid (x) -# usage: grid ("on" | "off") -# -# Turn grid lines on or off for plotting. -# -# If the argument is omitted, "on" is assumed. -# -# See also: plot, semilogx, semilogy, loglog, polar, mesh, contour, -# bar, stairs, gplot, gsplot, replot, xlabel, ylabel, title + ## usage: grid ("on" | "off") + ## + ## Turn grid lines on or off for plotting. + ## + ## If the argument is omitted, "on" is assumed. + ## + ## See also: plot, semilogx, semilogy, loglog, polar, mesh, contour, + ## bar, stairs, gplot, gsplot, replot, xlabel, ylabel, title if (nargin == 0) set grid;
--- a/scripts/plot/hist.m +++ b/scripts/plot/hist.m @@ -1,43 +1,44 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function [nn, xx] = hist (y, x) -# usage: [NN, XX] = hist (Y, X) or hist (Y, X) -# -# Produce histogram counts or plots. -# -# With one vector input argument, plot a histogram of the values with -# 10 bins. The range of the histogram bins is determined by the range -# of the data. -# -# Given a second scalar argument, use that as the number of bins. -# -# Given a second vector argument, use that as the centers of the bins, -# with the width of the bins determened from the adjacent values in -# the vector. -# -# Extreme values are lumped in the first and last bins. -# -# With two output arguments, produce the values NN and XX such that -# bar (XX, NN) will plot the histogram. -# -# See also: bar + ## usage: [NN, XX] = hist (Y, X) or hist (Y, X) + ## + ## Produce histogram counts or plots. + ## + ## With one vector input argument, plot a histogram of the values with + ## 10 bins. The range of the histogram bins is determined by the range + ## of the data. + ## + ## Given a second scalar argument, use that as the number of bins. + ## + ## Given a second vector argument, use that as the centers of the bins, + ## with the width of the bins determened from the adjacent values in + ## the vector. + ## + ## Extreme values are lumped in the first and last bins. + ## + ## With two output arguments, produce the values NN and XX such that + ## bar (XX, NN) will plot the histogram. + ## + ## See also: bar if (nargin < 1 || nargin > 2) usage ("[nn, xx] = hist (y, x)");
--- a/scripts/plot/loglog.m +++ b/scripts/plot/loglog.m @@ -1,34 +1,35 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function loglog (...) -# usage: loglog (x, y) -# loglog (x1, y1, x2, y2, ...) -# loglog (x, y, fmt) -# -# Make a 2D plot of y versus x using a log scale for the x axis. -# -# See the help message for the plot command for a description of how -# the arguments are interpreted. -# -# See also: plot, semilogy, loglog, polar, mesh, contour, bar, stairs, -# gplot, gsplot, replot, xlabel, ylabel, title + ## usage: loglog (x, y) + ## loglog (x1, y1, x2, y2, ...) + ## loglog (x, y, fmt) + ## + ## Make a 2D plot of y versus x using a log scale for the x axis. + ## + ## See the help message for the plot command for a description of how + ## the arguments are interpreted. + ## + ## See also: plot, semilogy, loglog, polar, mesh, contour, bar, stairs, + ## gplot, gsplot, replot, xlabel, ylabel, title set logscale x; set logscale y;
--- a/scripts/plot/mesh.m +++ b/scripts/plot/mesh.m @@ -1,33 +1,34 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function mesh (x, y, z) -# usage: mesh (x, y, z) -# -# Surface plot. If x, y, and z are matrices with the same dimensions, -# then corresponding elements represent vertices of the plot. If x and -# y are vectors, then a typical vertex is (x(j), y(i), z(i,j)). Thus, -# columns of z correspond to different x values and rows of z correspond -# to different y values. -# -# See also: plot, semilogx, semilogy, loglog, polar, meshgrid, meshdom, -# contour, bar, stairs, gplot, gsplot, replot, xlabel, ylabel, title + ## usage: mesh (x, y, z) + ## + ## Surface plot. If x, y, and z are matrices with the same dimensions, + ## then corresponding elements represent vertices of the plot. If x and + ## y are vectors, then a typical vertex is (x(j), y(i), z(i,j)). Thus, + ## columns of z correspond to different x values and rows of z correspond + ## to different y values. + ## + ## See also: plot, semilogx, semilogy, loglog, polar, meshgrid, meshdom, + ## contour, bar, stairs, gplot, gsplot, replot, xlabel, ylabel, title if (nargin == 1) z = x;
--- a/scripts/plot/meshdom.m +++ b/scripts/plot/meshdom.m @@ -1,32 +1,33 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function [xx, yy] = meshdom (x, y) -# usage: [xx, yy] = meshdom (x, y) -# -# Given vectors of x and y coordinates, return two matrices -# corresponding to the x and y coordinates of the mesh. -# -# See the file sombrero.m for an example of using mesh and meshdom. -# -# See also: plot, semilogx, semilogy, loglog, polar, mesh, contour, -# bar, stairs, gplot, gsplot, replot, xlabel, ylabel, title + ## usage: [xx, yy] = meshdom (x, y) + ## + ## Given vectors of x and y coordinates, return two matrices + ## corresponding to the x and y coordinates of the mesh. + ## + ## See the file sombrero.m for an example of using mesh and meshdom. + ## + ## See also: plot, semilogx, semilogy, loglog, polar, mesh, contour, + ## bar, stairs, gplot, gsplot, replot, xlabel, ylabel, title if (nargin == 2) if (is_vector (x) && is_vector (y))
--- a/scripts/plot/meshgrid.m +++ b/scripts/plot/meshgrid.m @@ -1,33 +1,34 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function [xx, yy] = meshgrid (x, y) -# usage: [xx, yy] = meshgrid (x, y) -# -# Given vectors of x and y coordinates, return two matrices corresponding -# to the x and y coordinates of a mesh. The rows of xx are copies of x, -# and the columns of yy are copies of y. -# -# [xx, yy] = meshgrid (x) is an abbreviation for [xx, yy] = meshgrid (x, x). -# -# See also: plot, semilogx, semilogy, loglog, polar, mesh, meshdom, contour, -# bar, stairs, gplot, gsplot, replot, xlabel, ylabel, title + ## usage: [xx, yy] = meshgrid (x, y) + ## + ## Given vectors of x and y coordinates, return two matrices corresponding + ## to the x and y coordinates of a mesh. The rows of xx are copies of x, + ## and the columns of yy are copies of y. + ## + ## [xx, yy] = meshgrid (x) is an abbreviation for [xx, yy] = meshgrid (x, x). + ## + ## See also: plot, semilogx, semilogy, loglog, polar, mesh, meshdom, contour, + ## bar, stairs, gplot, gsplot, replot, xlabel, ylabel, title if (nargin == 1) y = x;
--- a/scripts/plot/mplot.m +++ b/scripts/plot/mplot.m @@ -1,53 +1,53 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function mplot (...) -# usage: mplot (x, y) -# mplot (x1, y1, x2, y2, ...) -# mplot (x, y, fmt) -# -# This is a modified version of plot() command to work with -# multiplot version of gnuplot to plot multiple plots per page. -# This plot version automatically updates the plot position to -# next plot position after making the plot in the given subplot -# position. -# -# See command plot() for the various options to this command -# as this is just mulitplot version of the same command. + ## usage: mplot (x, y) + ## mplot (x1, y1, x2, y2, ...) + ## mplot (x, y, fmt) + ## + ## This is a modified version of plot() command to work with + ## multiplot version of gnuplot to plot multiple plots per page. + ## This plot version automatically updates the plot position to + ## next plot position after making the plot in the given subplot + ## position. + ## + ## See command plot() for the various options to this command + ## as this is just mulitplot version of the same command. -# Written by Vinayak Dutt, Dutt.Vinayak@mayo.EDU + ## Written by Vinayak Dutt, Dutt.Vinayak@mayo.EDU if (! gnuplot_has_multiplot) error ("mplot: gnuplot does not appear to support this feature"); endif - # global variables to keep track of multiplot options + ## global variables to keep track of multiplot options global multiplot_mode global multiplot_xsize multiplot_ysize global multiplot_xn multiplot_yn global multiplot_xi multiplot_yi - # This is a real kludge. We gnuplot should be made so that replot can - # be executed while doing multiple plots... + ## This is a real kludge. We gnuplot should be made so that replot can + ## be executed while doing multiple plots... global multiplot_save_auto_replot = automatic_replot @@ -63,7 +63,7 @@ plot_int ("plot", all_va_args); - # update the plot position + ## update the plot position if (multiplot_mode)
--- a/scripts/plot/multiplot.m +++ b/scripts/plot/multiplot.m @@ -1,50 +1,50 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function multiplot (xn, yn) -# usage: multiplot (xn, yn) -# -# Sets and resets multiplot mode -# -# If multiplot(0,0) then it will close multiplot mode and and if -# arguments are non-zero, then it will set up multiplot mode with -# xn,yn subplots along x and y axes. -# -# NOTE: this will work only with gnuplot installed with -# multiplot patch + ## usage: multiplot (xn, yn) + ## + ## Sets and resets multiplot mode + ## + ## If multiplot(0,0) then it will close multiplot mode and and if + ## arguments are non-zero, then it will set up multiplot mode with + ## xn,yn subplots along x and y axes. + ## + ## NOTE: this will work only with gnuplot installed with + ## multiplot patch -# Written by Vinayak Dutt, Dutt.Vinayak@mayo.EDU 3 Jul 95 + ## Written by Vinayak Dutt, Dutt.Vinayak@mayo.EDU 3 Jul 95 if (! gnuplot_has_multiplot) error ("multiplot: gnuplot does not appear to support this feature"); endif - # global variables to keep track of multiplot options + ## global variables to keep track of multiplot options global multiplot_mode global multiplot_xsize multiplot_ysize global multiplot_xn multiplot_yn global multiplot_xi multiplot_yi - # This is a real kludge. We gnuplot should be made so that replot can - # be executed while doing multiple plots... + ## This is a real kludge. We gnuplot should be made so that replot can + ## be executed while doing multiple plots... global multiplot_save_auto_replot = automatic_replot @@ -80,7 +80,7 @@ multiplot_xi = 1; multiplot_yi = 1; - # Someone may have reset it betweeen calls... + ## Someone may have reset it betweeen calls... if (! isstr (automatic_replot) && ! automatic_replot) automatic_replot = multiplot_save_auto_replot;
--- a/scripts/plot/oneplot.m +++ b/scripts/plot/oneplot.m @@ -1,33 +1,33 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function oneplot () -# usage: oneplot -# -# NOTE: this will work only with gnuplot installed with -# multiplot patch -# -# Switches from multiplot (if in multiplot mode) to single plot -# mode + ## usage: oneplot + ## + ## NOTE: this will work only with gnuplot installed with + ## multiplot patch + ## + ## Switches from multiplot (if in multiplot mode) to single plot + ## mode -# Written by Vinayak Dutt, Dutt.Vinayak@mayo.EDU 3 Jul 95 + ## Written by Vinayak Dutt, Dutt.Vinayak@mayo.EDU 3 Jul 95 if (! gnuplot_has_multiplot) error ("oneplot: gnuplot does not appear to support this feature");
--- a/scripts/plot/plot.m +++ b/scripts/plot/plot.m @@ -1,66 +1,67 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function plot (...) -# usage: plot (x, y) -# plot (x1, y1, x2, y2, ...) -# plot (x, y, fmt) -# -# If the first argument is a vector and the second is a matrix, the -# the vector is plotted versus the columns (or rows) of the matrix. -# (using whichever combination matches, with columns tried first.) -# -# If the first argument is a matrix and the second is a vector, the -# the columns (or rows) of the matrix are plotted versus the vector. -# (using whichever combination matches, with columns tried first.) -# -# If both arguments are vectors, the elements of y are plotted versus -# the elements of x. -# -# If both arguments are matrices, the columns of y are plotted versus -# the columns of x. In this case, both matrices must have the same -# number of rows and columns and no attempt is made to transpose the -# arguments to make the number of rows match. -# -# If both arguments are scalars, a single point is plotted. -# -# If only one argument is given, it is taken as the set of y -# coordinates and the x coordinates are taken to be the indices of the -# elements, starting with 1. -# -# To see possible options for FMT please see plot_opt. -# -# Examples: -# -# plot (x, y, "@12", x, y2, x, y3, "4", x, y4, "+") -# -# y will be plotted with points of type 2 ("+") and color 1 (red). -# y2 will be plotted with lines. -# y3 will be plotted with lines of color 4. -# y4 will be plotted with points which are "+"s. -# -# plot (b, "*") -# -# b will be plotted with points of type "*". -# -# See also: semilogx, semilogy, loglog, polar, mesh, contour, plot_opt -# bar, stairs, gplot, gsplot, replot, xlabel, ylabel, title + ## usage: plot (x, y) + ## plot (x1, y1, x2, y2, ...) + ## plot (x, y, fmt) + ## + ## If the first argument is a vector and the second is a matrix, the + ## the vector is plotted versus the columns (or rows) of the matrix. + ## (using whichever combination matches, with columns tried first.) + ## + ## If the first argument is a matrix and the second is a vector, the + ## the columns (or rows) of the matrix are plotted versus the vector. + ## (using whichever combination matches, with columns tried first.) + ## + ## If both arguments are vectors, the elements of y are plotted versus + ## the elements of x. + ## + ## If both arguments are matrices, the columns of y are plotted versus + ## the columns of x. In this case, both matrices must have the same + ## number of rows and columns and no attempt is made to transpose the + ## arguments to make the number of rows match. + ## + ## If both arguments are scalars, a single point is plotted. + ## + ## If only one argument is given, it is taken as the set of y + ## coordinates and the x coordinates are taken to be the indices of the + ## elements, starting with 1. + ## + ## To see possible options for FMT please see plot_opt. + ## + ## Examples: + ## + ## plot (x, y, "@12", x, y2, x, y3, "4", x, y4, "+") + ## + ## y will be plotted with points of type 2 ("+") and color 1 (red). + ## y2 will be plotted with lines. + ## y3 will be plotted with lines of color 4. + ## y4 will be plotted with points which are "+"s. + ## + ## plot (b, "*") + ## + ## b will be plotted with points of type "*". + ## + ## See also: semilogx, semilogy, loglog, polar, mesh, contour, plot_opt + ## bar, stairs, gplot, gsplot, replot, xlabel, ylabel, title set nologscale; set nopolar;
--- a/scripts/plot/plot_border.m +++ b/scripts/plot/plot_border.m @@ -1,44 +1,44 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function plot_border (...) -# usage: plot_border (...) -# -# NOTE: this will work only with gnuplot installed with -# multiplot patch -# -# Multiple arguments allowed to specify the sides on which the border -# is shown. allowed strings: -# -# allowed input strings: -# -# "blank", "BLANK", "b", "B", ---> No borders displayed -# "all", "ALL", "a", "A", ---> All borders displayed -# "north", "NORTH", "n", "N", ---> North Border -# "south", "SOUTH", "s", "S", ---> South Border -# "east", "EAST", "e", "E", ---> East Border -# "west", "WEST", "w", "W", ---> West Border -# -# Without any arguments, turns borders off. + ## usage: plot_border (...) + ## + ## NOTE: this will work only with gnuplot installed with + ## multiplot patch + ## + ## Multiple arguments allowed to specify the sides on which the border + ## is shown. allowed strings: + ## + ## allowed input strings: + ## + ## "blank", "BLANK", "b", "B", ---> No borders displayed + ## "all", "ALL", "a", "A", ---> All borders displayed + ## "north", "NORTH", "n", "N", ---> North Border + ## "south", "SOUTH", "s", "S", ---> South Border + ## "east", "EAST", "e", "E", ---> East Border + ## "west", "WEST", "w", "W", ---> West Border + ## + ## Without any arguments, turns borders off. -# Written by Vinayak Dutt, Dutt.Vinayak@mayo.EDU 3 Jul 95 + ## Written by Vinayak Dutt, Dutt.Vinayak@mayo.EDU 3 Jul 95 if (! gnuplot_has_multiplot) error ("plot_border: gnuplot does not appear to support this feature"); @@ -61,8 +61,8 @@ error ("plot_border: input not a string"); endif - # The effect of the arguments in cumulative. If something is found - # after "b", do that and ignore "b". + ## The effect of the arguments in cumulative. If something is found + ## after "b", do that and ignore "b". if (strcmp (arg, "blank") || strcmp (arg, "BLANK") || strcmp (arg, "b") || strcmp (arg, "B"))
--- a/scripts/plot/polar.m +++ b/scripts/plot/polar.m @@ -1,31 +1,32 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function polar (x1, x2, fmt) -# usage: polar (theta, rho, fmt) -# -# Make a 2D plot given polar the coordinates theta and rho. -# -# The optional third argument specifies the line type. -# -# See also: plot, semilogx, semilogy, loglog, mesh, contour, bar, -# stairs, gplot, gsplot, replot, xlabel, ylabel, title + ## usage: polar (theta, rho, fmt) + ## + ## Make a 2D plot given polar the coordinates theta and rho. + ## + ## The optional third argument specifies the line type. + ## + ## See also: plot, semilogx, semilogy, loglog, mesh, contour, bar, + ## stairs, gplot, gsplot, replot, xlabel, ylabel, title set nologscale; set nopolar;
--- a/scripts/plot/semilogx.m +++ b/scripts/plot/semilogx.m @@ -1,34 +1,35 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function semilogx (...) -# usage: semilogx (x, y) -# semilogx (x1, y1, x2, y2, ...) -# semilogx (x, y, fmt) -# -# Make a 2D plot of y versus x using a log scale for the x axis. -# -# See the help message for the plot command for a description of how -# the arguments are interpreted. -# -# See also: plot, semilogy, loglog, polar, mesh, contour, bar, stairs, -# gplot, gsplot, replot, xlabel, ylabel, title + ## usage: semilogx (x, y) + ## semilogx (x1, y1, x2, y2, ...) + ## semilogx (x, y, fmt) + ## + ## Make a 2D plot of y versus x using a log scale for the x axis. + ## + ## See the help message for the plot command for a description of how + ## the arguments are interpreted. + ## + ## See also: plot, semilogy, loglog, polar, mesh, contour, bar, stairs, + ## gplot, gsplot, replot, xlabel, ylabel, title set logscale x; set nologscale y;
--- a/scripts/plot/semilogy.m +++ b/scripts/plot/semilogy.m @@ -1,34 +1,35 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function semilogy (...) -# usage: semilogy (x, y) -# semilogy (x1, y1, x2, y2, ...) -# semilogy (x, y, fmt) -# -# Make a 2D plot of y versus x using a log scale for the x axis. -# -# See the help message for the plot command for a description of how -# the arguments are interpreted. -# -# See also: plot, semilogx, loglog, polar, mesh, contour, bar, stairs, -# gplot, gsplot, replot, xlabel, ylabel, title + ## usage: semilogy (x, y) + ## semilogy (x1, y1, x2, y2, ...) + ## semilogy (x, y, fmt) + ## + ## Make a 2D plot of y versus x using a log scale for the x axis. + ## + ## See the help message for the plot command for a description of how + ## the arguments are interpreted. + ## + ## See also: plot, semilogx, loglog, polar, mesh, contour, bar, stairs, + ## gplot, gsplot, replot, xlabel, ylabel, title set nologscale x; set logscale y;
--- a/scripts/plot/shg.m +++ b/scripts/plot/shg.m @@ -1,30 +1,31 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function shg () -# usage: shg -# -# Show the graph window. Currently, this is the same as executing -# replot without any arguments. -# -# See also: plot, semilogx, semilogy, loglog, polar, mesh, contour, -# bar, stairs, gplot, gsplot, replot, xlabel, ylabel + ## usage: shg + ## + ## Show the graph window. Currently, this is the same as executing + ## replot without any arguments. + ## + ## See also: plot, semilogx, semilogy, loglog, polar, mesh, contour, + ## bar, stairs, gplot, gsplot, replot, xlabel, ylabel if (nargin != 0) warning ("shg: ignoring extra arguments");
--- a/scripts/plot/sombrero.m +++ b/scripts/plot/sombrero.m @@ -1,29 +1,30 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function sombrero (n) -# usage: sombrero (n) -# -# Draw a `sombrero' in three dimensions using n grid lines. The -# function plotted is -# -# z = sin (x^2 + y^2) / (x^2 + y^2); + ## usage: sombrero (n) + ## + ## Draw a `sombrero' in three dimensions using n grid lines. The + ## function plotted is + ## + ## z = sin (x^2 + y^2) / (x^2 + y^2); if (nargin != 1) usage ("sombrero (n)");
--- a/scripts/plot/stairs.m +++ b/scripts/plot/stairs.m @@ -1,44 +1,45 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function [xs, ys] = stairs (x, y) -# usage: [xs, ys] = stairs (x, y) -# -# Given two vectors of x-y data, stairs produces a `stairstep' plot. -# -# If only one argument is given, it is taken as a vector of y-values -# and the x coordiates are taken to be the indices of the elements. -# -# If two output arguments are specified, the data are generated but -# not plotted. For example, -# -# stairs (x, y); -# -# and -# -# [xs, ys] = stairs (x, y); -# plot (xs, ys); -# -# are equivalent. -# -# See also: plot, semilogx, semilogy, loglog, polar, mesh, contour, -# bar, gplot, gsplot, replot, xlabel, ylabel, title + ## usage: [xs, ys] = stairs (x, y) + ## + ## Given two vectors of x-y data, stairs produces a `stairstep' plot. + ## + ## If only one argument is given, it is taken as a vector of y-values + ## and the x coordiates are taken to be the indices of the elements. + ## + ## If two output arguments are specified, the data are generated but + ## not plotted. For example, + ## + ## stairs (x, y); + ## + ## and + ## + ## [xs, ys] = stairs (x, y); + ## plot (xs, ys); + ## + ## are equivalent. + ## + ## See also: plot, semilogx, semilogy, loglog, polar, mesh, contour, + ## bar, gplot, gsplot, replot, xlabel, ylabel, title if (nargin == 1)
--- a/scripts/plot/subplot.m +++ b/scripts/plot/subplot.m @@ -1,75 +1,75 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function subplot (rows, columns, index) -# usage: subplot (rows, columns, index) -# subplot (rcn) -# -# NOTE: this will work only with gnuplot installed with -# multiplot patch (or version 3.6 beta) -# -# Sets gnuplot in multiplot mode and plots in location -# given by index (there are columns X rows subwindows) -# -# Input: -# -# rows : number of rows in subplot grid -# columns: number of columns in subplot grid -# index : index of subplot where to make the next plot -# -# If only one arg, then it (crn) has to be three digit value -# specifying the location in digit 1 (rows) and 2 (columns) and digit -# 3 is the plot index -# -# The plot index runs row-wise,i.e., first all the columns in a row -# are filled and then the next row is filled -# -# For example, plot with 4 X 2 grid, will have plot indices running as -# follows: -# -# ----------------------------------- -# | | | | | -# | 1 | 2 | 3 | 4 | -# | | | | | -# ----------------------------------- -# | | | | | -# | 5 | 6 | 7 | 8 | -# | | | | | -# ----------------------------------- -# + ## usage: subplot (rows, columns, index) + ## subplot (rcn) + ## + ## NOTE: this will work only with gnuplot installed with + ## multiplot patch (or version 3.6 beta) + ## + ## Sets gnuplot in multiplot mode and plots in location + ## given by index (there are columns X rows subwindows) + ## + ## Input: + ## + ## rows : number of rows in subplot grid + ## columns: number of columns in subplot grid + ## index : index of subplot where to make the next plot + ## + ## If only one arg, then it (crn) has to be three digit value + ## specifying the location in digit 1 (rows) and 2 (columns) and digit + ## 3 is the plot index + ## + ## The plot index runs row-wise,i.e., first all the columns in a row + ## are filled and then the next row is filled + ## + ## For example, plot with 4 X 2 grid, will have plot indices running as + ## follows: + ## + ## ----------------------------------- + ## | | | | | + ## | 1 | 2 | 3 | 4 | + ## | | | | | + ## ----------------------------------- + ## | | | | | + ## | 5 | 6 | 7 | 8 | + ## | | | | | + ## ----------------------------------- + ## -# Written by Vinayak Dutt, Dutt.Vinayak@mayo.EDU + ## Written by Vinayak Dutt, Dutt.Vinayak@mayo.EDU if (! gnuplot_has_multiplot) error ("subplot: gnuplot does not appear to support this feature"); endif - # global variables to keep track of multiplot options + ## global variables to keep track of multiplot options global multiplot_mode global multiplot_xsize multiplot_ysize global multiplot_xn multiplot_yn global multiplot_xi multiplot_yi - # This is a real kludge. We gnuplot should be made so that replot can - # be executed while doing multiple plots... + ## This is a real kludge. We gnuplot should be made so that replot can + ## be executed while doing multiple plots... global multiplot_save_auto_replot = automatic_replot @@ -115,7 +115,7 @@ if (columns*rows == 1) - # switching to single plot ? + ## switching to single plot ? set nomultiplot; set size 1, 1; @@ -125,7 +125,7 @@ multiplot_yn = 1; multiplot_mode = 0; - # Someone may have reset it betweeen calls... + ## Someone may have reset it betweeen calls... if (! isstr (automatic_replot) && ! automatic_replot) automatic_replot = multiplot_save_auto_replot; @@ -133,7 +133,7 @@ else - # doing multiplot plots + ## doing multiplot plots doagain = 0; @@ -158,14 +158,14 @@ endif - # get the sub plot location + ## get the sub plot location yp = fix ((index-1)/columns); xp = index - yp*columns - 1; multiplot_xi = ++xp; multiplot_yi = ++yp; - # set the origin + ## set the origin xo = (xp - 1.0)*multiplot_xsize; yo = (rows - yp)*multiplot_ysize;
--- a/scripts/plot/subwindow.m +++ b/scripts/plot/subwindow.m @@ -1,52 +1,52 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function subwindow (xn, yn) -# usage: subwindow (xn, yn) -# -# NOTE: this will work only with gnuplot installed with -# multiplot patch -# -# Sets subwindow position in multiplot mode for next plot. The -# multiplot mode has to be previously initialized using multiplot() -# command, else this command just becomes an aliad to multiplot() + ## usage: subwindow (xn, yn) + ## + ## NOTE: this will work only with gnuplot installed with + ## multiplot patch + ## + ## Sets subwindow position in multiplot mode for next plot. The + ## multiplot mode has to be previously initialized using multiplot() + ## command, else this command just becomes an aliad to multiplot() -# Written by Vinayak Dutt, Dutt.Vinayak@mayo.EDU 3 Jul 95 + ## Written by Vinayak Dutt, Dutt.Vinayak@mayo.EDU 3 Jul 95 if (! gnuplot_has_multiplot) error ("subwindow: gnuplot does not appear to support this feature"); endif - # global variables to keep track of multiplot options + ## global variables to keep track of multiplot options global multiplot_mode global multiplot_xsize multiplot_ysize global multiplot_xn multiplot_yn - # check calling argument count + ## check calling argument count if (nargin != 2) usage ("subwindow (xn, yn)"); endif - # check for scalar inputs + ## check for scalar inputs if (! (is_scalar (xn) && is_scalar (yn))) error ("subwindow: xn and yn have to be scalars"); @@ -55,15 +55,15 @@ xn = round (xn); yn = round (yn); - # switch to multiplot mode if not already in, and use the args as the - # args to multiplot() + ## switch to multiplot mode if not already in, and use the args as the + ## args to multiplot() if (multiplot_mode != 1) multiplot (xn, yn); return; endif - # get the sub plot location + ## get the sub plot location if (xn < 1 || xn > multiplot_xn || yn < 1 || yn > multiplot_yn) error ("subwindow: incorrect xn and yn");
--- a/scripts/plot/title.m +++ b/scripts/plot/title.m @@ -1,30 +1,31 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function title (text) -# usage: title (text) -# -# Defines a title for a plot. The title will appear the next time a -# plot is displayed. -# -# See also: plot, semilogx, semilogy, loglog, polar, mesh, contour, -# bar, stairs, gplot, gsplot, replot, xlabel, ylabel + ## usage: title (text) + ## + ## Defines a title for a plot. The title will appear the next time a + ## plot is displayed. + ## + ## See also: plot, semilogx, semilogy, loglog, polar, mesh, contour, + ## bar, stairs, gplot, gsplot, replot, xlabel, ylabel if (nargin != 1) usage ("title (text)");
--- a/scripts/plot/top_title.m +++ b/scripts/plot/top_title.m @@ -1,32 +1,32 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function top_title (text) -# usage: top_title (text) -# -# NOTE: this will work only with gnuplot installed with -# multiplot patch -# -# makes a title with text "text" at the top of the plot + ## usage: top_title (text) + ## + ## NOTE: this will work only with gnuplot installed with + ## multiplot patch + ## + ## makes a title with text "text" at the top of the plot -# Written by Vinayak Dutt, Dutt.Vinayak@mayo.EDU 3 Jul 95 + ## Written by Vinayak Dutt, Dutt.Vinayak@mayo.EDU 3 Jul 95 if (! gnuplot_has_multiplot) error ("top_title: gnuplot does not appear to support this feature");
--- a/scripts/plot/xlabel.m +++ b/scripts/plot/xlabel.m @@ -1,30 +1,31 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function xlabel (text) -# usage: xlabel (text) -# -# Defines a label for the x-axis of a plot. The label will appear the -# next time a plot is displayed. -# -# See also: plot, semilogx, semilogy, loglog, polar, mesh, contour, -# bar, stairs, gplot, gsplot, replot, ylabel, title + ## usage: xlabel (text) + ## + ## Defines a label for the x-axis of a plot. The label will appear the + ## next time a plot is displayed. + ## + ## See also: plot, semilogx, semilogy, loglog, polar, mesh, contour, + ## bar, stairs, gplot, gsplot, replot, ylabel, title if (nargin != 1) usage ("xlabel (text)");
--- a/scripts/plot/ylabel.m +++ b/scripts/plot/ylabel.m @@ -1,30 +1,31 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function ylabel (text) -# usage: ylabel (text) -# -# Defines a label for the y-axis of a plot. The label will appear the -# next time a plot is displayed. -# -# See also: plot, semilogx, semilogy, loglog, polar, mesh, contour, -# bar, stairs, gplot, gsplot, replot, xlabel, title + ## usage: ylabel (text) + ## + ## Defines a label for the y-axis of a plot. The label will appear the + ## next time a plot is displayed. + ## + ## See also: plot, semilogx, semilogy, loglog, polar, mesh, contour, + ## bar, stairs, gplot, gsplot, replot, xlabel, title if (nargin != 1) usage ("ylabel (text)");
--- a/scripts/plot/zlabel.m +++ b/scripts/plot/zlabel.m @@ -1,32 +1,32 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function zlabel (text) -# usage: zlabel (text) -# -# Defines a label for the z-axis of a plot. The label will appear the -# next time a plot is displayed. -# -# See other plotting commands also. + ## usage: zlabel (text) + ## + ## Defines a label for the z-axis of a plot. The label will appear the + ## next time a plot is displayed. + ## + ## See other plotting commands also. -# Written by Vinayak Dutt, Dutt.Vinayak@mayo.EDU 3 Jul 95 + ## Written by Vinayak Dutt, Dutt.Vinayak@mayo.EDU 3 Jul 95 if (nargin != 1) usage ("zlabel (text)");
--- a/scripts/polynomial/compan.m +++ b/scripts/polynomial/compan.m @@ -1,49 +1,50 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function A = compan (c) -# usage: compan (c) -# -# Compute the companion matrix corresponding to polynomial vector c. -# -# In octave a polynomial is represented by it's coefficients (arranged -# in descending order). For example a vector c of length n+1 corresponds -# to the following nth order polynomial -# -# p(x) = c(1) x^n + ... + c(n) x + c(n+1). -# -# The corresponding companion matrix is -# _ _ -# | -c(2)/c(1) -c(3)/c(1) ... -c(n)/c(1) -c(n+1)/c(1) | -# | 1 0 ... 0 0 | -# | 0 1 ... 0 0 | -# A = | . . . . . | -# | . . . . . | -# | . . . . . | -# |_ 0 0 ... 1 0 _| -# -# The eigenvalues of the companion matrix are equal to the roots of the -# polynomial. -# -# SEE ALSO: poly, roots, residue, conv, deconv, polyval, polyderiv, polyinteg + ## usage: compan (c) + ## + ## Compute the companion matrix corresponding to polynomial vector c. + ## + ## In octave a polynomial is represented by it's coefficients (arranged + ## in descending order). For example a vector c of length n+1 corresponds + ## to the following nth order polynomial + ## + ## p(x) = c(1) x^n + ... + c(n) x + c(n+1). + ## + ## The corresponding companion matrix is + ## _ _ + ## | -c(2)/c(1) -c(3)/c(1) ... -c(n)/c(1) -c(n+1)/c(1) | + ## | 1 0 ... 0 0 | + ## | 0 1 ... 0 0 | + ## A = | . . . . . | + ## | . . . . . | + ## | . . . . . | + ## |_ 0 0 ... 1 0 _| + ## + ## The eigenvalues of the companion matrix are equal to the roots of the + ## polynomial. + ## + ## SEE ALSO: poly, roots, residue, conv, deconv, polyval, polyderiv, polyinteg -# Written by Tony Richardson (amr@mpl.ucsd.edu) June 1994. + ## Written by Tony Richardson (amr@mpl.ucsd.edu) June 1994. if (nargin != 1) usage ("compan (vector)"); @@ -53,7 +54,7 @@ error("compan: expecting a vector argument."); endif -# Ensure that c is a row vector. + ## Ensure that c is a row vector. if(rows(c) > 1) c = c.';
--- a/scripts/polynomial/conv.m +++ b/scripts/polynomial/conv.m @@ -1,36 +1,37 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function y = conv (a, b) -# usage: conv (a, b) -# -# Convolve two vectors. -# -# y = conv (a, b) returns a vector of length equal to length (a) + -# length (b) -1. -# -# If a and b are polynomial coefficient vectors, conv returns the -# coefficients of the product polynomial. -# -# SEE ALSO: deconv, poly, roots, residue, polyval, polyderiv, polyinteg + ## usage: conv (a, b) + ## + ## Convolve two vectors. + ## + ## y = conv (a, b) returns a vector of length equal to length (a) + + ## length (b) -1. + ## + ## If a and b are polynomial coefficient vectors, conv returns the + ## coefficients of the product polynomial. + ## + ## SEE ALSO: deconv, poly, roots, residue, polyval, polyderiv, polyinteg -# Written by Tony Richardson (amr@mpl.ucsd.edu) June 1994. + ## Written by Tony Richardson (amr@mpl.ucsd.edu) June 1994. if (nargin != 2) usage ("conv(a, b)"); @@ -45,7 +46,7 @@ ly = la + lb - 1; - # Ensure that both vectors are row vectors. + ## Ensure that both vectors are row vectors. if (rows (a) > 1) a = reshape (a, 1, la); endif @@ -53,7 +54,7 @@ b = reshape (b, 1, lb); endif - # Use the shortest vector as the coefficent vector to filter. + ## Use the shortest vector as the coefficent vector to filter. if (la < lb) if (ly > lb) x = [b, (zeros (1, ly - lb))];
--- a/scripts/polynomial/deconv.m +++ b/scripts/polynomial/deconv.m @@ -1,38 +1,39 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function [b, r] = deconv (y, a) -# usage: deconv (y, a) -# -# Deconvolve two vectors. -# -# [b, r] = deconv (y, a) solves for b and r such that -# y = conv(a,b) + r -# -# If y and a are polynomial coefficient vectors, b will contain the -# coefficients of the polynomial quotient and r will be a remander -# polynomial of lowest order. -# -# SEE ALSO: conv, poly, roots, residue, polyval, polyderiv, -# polyinteg + ## usage: deconv (y, a) + ## + ## Deconvolve two vectors. + ## + ## [b, r] = deconv (y, a) solves for b and r such that + ## y = conv(a,b) + r + ## + ## If y and a are polynomial coefficient vectors, b will contain the + ## coefficients of the polynomial quotient and r will be a remander + ## polynomial of lowest order. + ## + ## SEE ALSO: conv, poly, roots, residue, polyval, polyderiv, + ## polyinteg -# Written by Tony Richardson (amr@mpl.ucsd.edu) June 1994. + ## Written by Tony Richardson (amr@mpl.ucsd.edu) June 1994. if (nargin != 2) usage ("deconv (y, a)");
--- a/scripts/polynomial/poly.m +++ b/scripts/polynomial/poly.m @@ -1,33 +1,34 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function y = poly (x) -# usage: poly (x) -# -# If A is a square n-by-n matrix, poly (A) is the row vector of -# the coefficients of det (z * eye(n) - A), the characteristic -# polynomial of A. -# -# If x is a vector, poly (x) is a vector of coefficients of the -# polynomial whose roots are the elements of x. + ## usage: poly (x) + ## + ## If A is a square n-by-n matrix, poly (A) is the row vector of + ## the coefficients of det (z * eye(n) - A), the characteristic + ## polynomial of A. + ## + ## If x is a vector, poly (x) is a vector of coefficients of the + ## polynomial whose roots are the elements of x. -# Written by KH (Kurt.Hornik@neuro.tuwien.ac.at) Dec 24, 1993. + ## Written by KH (Kurt.Hornik@neuro.tuwien.ac.at) Dec 24, 1993. if (nargin != 1) usage ("poly (x)");
--- a/scripts/polynomial/polyder.m +++ b/scripts/polynomial/polyder.m @@ -1,26 +1,27 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function q = polyder (p) -# usage: polyder (p) -# -# SEE ALSO: polyderiv + ## usage: polyder (p) + ## + ## SEE ALSO: polyderiv if (nargin == 1) q = polyderiv (p);
--- a/scripts/polynomial/polyderiv.m +++ b/scripts/polynomial/polyderiv.m @@ -1,32 +1,33 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function q = polyderiv (p) -# usage: polyderiv (p) -# -# Returns the coefficients of the derivative of the polynomial whose -# coefficients are given by vector p. -# -# SEE ALSO: poly, polyinteg, polyreduce, roots, conv, deconv, residue, -# filter, polyval, polyvalm + ## usage: polyderiv (p) + ## + ## Returns the coefficients of the derivative of the polynomial whose + ## coefficients are given by vector p. + ## + ## SEE ALSO: poly, polyinteg, polyreduce, roots, conv, deconv, residue, + ## filter, polyval, polyvalm -# Written by Tony Richardson (amr@mpl.ucsd.edu) June 1994. + ## Written by Tony Richardson (amr@mpl.ucsd.edu) June 1994. if (nargin != 1) usage ("polyderiv (vector)");
--- a/scripts/polynomial/polyfit.m +++ b/scripts/polynomial/polyfit.m @@ -1,13 +1,32 @@ +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. + function p = polyfit (x, y, n) -# usage: polyfit (x, y, n) -# -# Returns the coefficients of a polynomial p(x) of degree n that -# minimizes sumsq (p(x(i)) - y(i)), i.e., that best fits the data -# in the least squares sense. + ## usage: polyfit (x, y, n) + ## + ## Returns the coefficients of a polynomial p(x) of degree n that + ## minimizes sumsq (p(x(i)) - y(i)), i.e., that best fits the data + ## in the least squares sense. -# Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Dec 13, 1994 -# Copyright Dept of Statistics and Probability Theory TU Wien + ## Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Dec 13, 1994 + ## Copyright Dept of Statistics and Probability Theory TU Wien if (nargin != 3) usage ("polyfit (x, y, n)"); @@ -32,8 +51,8 @@ X = [X, tmp]; endif - # Compute polynomial coeffients, making returned value compatible - # with Matlab. + ## Compute polynomial coeffients, making returned value compatible + ## with Matlab. [Q, R] = qr (X, 0);
--- a/scripts/polynomial/polyinteg.m +++ b/scripts/polynomial/polyinteg.m @@ -1,34 +1,35 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function p = polyinteg (p) -# usage: polyinteg (p) -# -# Returns the coefficients of the integral the polynomial whose coefficients -# are represented by the vector p. -# -# The constant of integration is zero. -# -# SEE ALSO: poly, polyderiv, polyreduce, roots, conv, deconv, residue, -# filter, polyval, polyvalm + ## usage: polyinteg (p) + ## + ## Returns the coefficients of the integral the polynomial whose coefficients + ## are represented by the vector p. + ## + ## The constant of integration is zero. + ## + ## SEE ALSO: poly, polyderiv, polyreduce, roots, conv, deconv, residue, + ## filter, polyval, polyvalm -# Written by Tony Richardson (amr@mpl.ucsd.edu) June 1994. + ## Written by Tony Richardson (amr@mpl.ucsd.edu) June 1994. if(nargin != 1) usage ("polyinteg (vector)"); @@ -46,7 +47,7 @@ end if (rows (p) > 1) -# Convert to column vector + ## Convert to column vector p = p.'; endif
--- a/scripts/polynomial/polyreduce.m +++ b/scripts/polynomial/polyreduce.m @@ -1,32 +1,33 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function p = polyreduce (p) -# usage: polyreduce(c) -# -# Reduces a polynomial coefficient vector to a minimum number of terms, -# i.e. it strips off any leading zeros. -# -# SEE ALSO: poly, roots, conv, deconv, residue, filter, polyval, polyvalm, -# polyderiv, polyinteg + ## usage: polyreduce(c) + ## + ## Reduces a polynomial coefficient vector to a minimum number of terms, + ## i.e. it strips off any leading zeros. + ## + ## SEE ALSO: poly, roots, conv, deconv, residue, filter, polyval, polyvalm, + ## polyderiv, polyinteg -# Written by Tony Richardson (amr@mpl.ucsd.edu) June 1994. + ## Written by Tony Richardson (amr@mpl.ucsd.edu) June 1994. index = find (p == 0);
--- a/scripts/polynomial/polyval.m +++ b/scripts/polynomial/polyval.m @@ -1,42 +1,43 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function y = polyval (c, x) -# usage: polyval (c, x) -# -# Evaluate a polynomial. -# -# In octave, a polynomial is represented by it's coefficients (arranged -# in descending order). For example a vector c of length n+1 corresponds -# to the following nth order polynomial -# -# p(x) = c(1) x^n + ... + c(n) x + c(n+1). -# -# polyval(c,x) will evaluate the polynomial at the specified value of x. -# -# If x is a vector or matrix, the polynomial is evaluated at each of the -# elements of x. -# -# SEE ALSO: polyvalm, poly, roots, conv, deconv, residue, filter, -# polyderiv, polyinteg + ## usage: polyval (c, x) + ## + ## Evaluate a polynomial. + ## + ## In octave, a polynomial is represented by it's coefficients (arranged + ## in descending order). For example a vector c of length n+1 corresponds + ## to the following nth order polynomial + ## + ## p(x) = c(1) x^n + ... + c(n) x + c(n+1). + ## + ## polyval(c,x) will evaluate the polynomial at the specified value of x. + ## + ## If x is a vector or matrix, the polynomial is evaluated at each of the + ## elements of x. + ## + ## SEE ALSO: polyvalm, poly, roots, conv, deconv, residue, filter, + ## polyderiv, polyinteg -# Written by Tony Richardson (amr@mpl.ucsd.edu) June 1994. + ## Written by Tony Richardson (amr@mpl.ucsd.edu) June 1994. if (nargin != 2) usage ("polyval (c, x)");
--- a/scripts/polynomial/polyvalm.m +++ b/scripts/polynomial/polyvalm.m @@ -1,43 +1,44 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function y = polyvalm (c, x) -# usage: polyvalm (c, x) -# -# Evaluate a polynomial in the matrix sense. -# -# In octave, a polynomial is represented by it's coefficients (arranged -# in descending order). For example a vector c of length n+1 corresponds -# to the following nth order polynomial -# -# p(x) = c(1) x^n + ... + c(n) x + c(n+1). -# -# polyvalm(c,X) will evaluate the polynomial in the matrix sense, i.e. matrix -# multiplication is used instead of element by element multiplication as is -# used in polyval. -# -# X must be a square matrix. -# -# SEE ALSO: polyval, poly, roots, conv, deconv, residue, filter, -# polyderiv, polyinteg + ## usage: polyvalm (c, x) + ## + ## Evaluate a polynomial in the matrix sense. + ## + ## In octave, a polynomial is represented by it's coefficients (arranged + ## in descending order). For example a vector c of length n+1 corresponds + ## to the following nth order polynomial + ## + ## p(x) = c(1) x^n + ... + c(n) x + c(n+1). + ## + ## polyvalm(c,X) will evaluate the polynomial in the matrix sense, i.e. matrix + ## multiplication is used instead of element by element multiplication as is + ## used in polyval. + ## + ## X must be a square matrix. + ## + ## SEE ALSO: polyval, poly, roots, conv, deconv, residue, filter, + ## polyderiv, polyinteg -# Written by Tony Richardson (amr@mpl.ucsd.edu) June 1994. + ## Written by Tony Richardson (amr@mpl.ucsd.edu) June 1994. if(nargin != 2) usage ("polyvalm (c, x)");
--- a/scripts/polynomial/residue.m +++ b/scripts/polynomial/residue.m @@ -1,130 +1,131 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function [r, p, k, e] = residue (b, a, toler) -# usage: [r, p, k, e] = residue (b, a) -# -# If b and a are vectors of polynomial coefficients, then residue -# calculates the partial fraction expansion corresponding to the -# ratio of the two polynomials. The vector r contains the residue -# terms, p contains the pole values, k contains the coefficients of -# a direct polynomial term (if it exists) and e is a vector containing -# the powers of the denominators in the partial fraction terms. -# Assuming b and a represent polynomials P(s) and Q(s) we have: -# -# P(s) M r(m) N -# ---- = # ------------- + # k(n)*s^(N-n) -# Q(s) m=1 (s-p(m))^e(m) n=1 -# -# (# represents summation) where M is the number of poles (the length of -# the r, p, and e vectors) and N is the length of the k vector. -# -# [r p k e] = residue(b,a,tol) -# -# This form of the function call may be used to set a tolerance value. -# The default value is 0.001. The tolerance value is used to determine -# whether poles with small imaginary components are declared real. It is -# also used to determine if two poles are distinct. If the ratio of the -# imaginary part of a pole to the real part is less than tol, the -# imaginary part is discarded. If two poles are farther apart than tol -# they are distinct. -# -# Example: -# b = [1, 1, 1]; -# a = [1, -5, 8, -4]; -# -# [r, p, k, e] = residue (b, a) -# -# returns -# -# r = [-2, 7, 3]; p = [2, 2, 1]; k = []; e = [1, 2, 1]; -# -# which implies the following partial fraction expansion -# -# s^2 + s + 1 -2 7 3 -# ------------------- = ----- + ------- + ----- -# s^3 - 5s^2 + 8s - 4 (s-2) (s-2)^2 (s-1) -# -# SEE ALSO: poly, roots, conv, deconv, polyval, polyderiv, polyinteg + ## usage: [r, p, k, e] = residue (b, a) + ## + ## If b and a are vectors of polynomial coefficients, then residue + ## calculates the partial fraction expansion corresponding to the + ## ratio of the two polynomials. The vector r contains the residue + ## terms, p contains the pole values, k contains the coefficients of + ## a direct polynomial term (if it exists) and e is a vector containing + ## the powers of the denominators in the partial fraction terms. + ## Assuming b and a represent polynomials P(s) and Q(s) we have: + ## + ## P(s) M r(m) N + ## ---- = # ------------- + # k(n)*s^(N-n) + ## Q(s) m=1 (s-p(m))^e(m) n=1 + ## + ## (# represents summation) where M is the number of poles (the length of + ## the r, p, and e vectors) and N is the length of the k vector. + ## + ## [r p k e] = residue(b,a,tol) + ## + ## This form of the function call may be used to set a tolerance value. + ## The default value is 0.001. The tolerance value is used to determine + ## whether poles with small imaginary components are declared real. It is + ## also used to determine if two poles are distinct. If the ratio of the + ## imaginary part of a pole to the real part is less than tol, the + ## imaginary part is discarded. If two poles are farther apart than tol + ## they are distinct. + ## + ## Example: + ## b = [1, 1, 1]; + ## a = [1, -5, 8, -4]; + ## + ## [r, p, k, e] = residue (b, a) + ## + ## returns + ## + ## r = [-2, 7, 3]; p = [2, 2, 1]; k = []; e = [1, 2, 1]; + ## + ## which implies the following partial fraction expansion + ## + ## s^2 + s + 1 -2 7 3 + ## ------------------- = ----- + ------- + ----- + ## s^3 - 5s^2 + 8s - 4 (s-2) (s-2)^2 (s-1) + ## + ## SEE ALSO: poly, roots, conv, deconv, polyval, polyderiv, polyinteg -# Written by Tony Richardson (amr@mpl.ucsd.edu) June 1994. + ## Written by Tony Richardson (amr@mpl.ucsd.edu) June 1994. -# Here's the method used to find the residues. -# The partial fraction expansion can be written as: -# -# -# P(s) D M(k) A(k,m) -# ---- = # # ------------- -# Q(s) k=1 m=1 (s - pr(k))^m -# -# (# is used to represent a summation) where D is the number of -# distinct roots, pr(k) is the kth distinct root, M(k) is the -# multiplicity of the root, and A(k,m) is the residue cooresponding -# to the kth distinct root with multiplicity m. For example, -# -# s^2 A(1,1) A(2,1) A(2,2) -# ------------------- = ------ + ------ + ------- -# s^3 + 4s^2 + 5s + 2 (s+2) (s+1) (s+1)^2 -# -# In this case there are two distinct roots (D=2 and pr = [-2 -1]), -# the first root has multiplicity one and the second multiplicity -# two (M = [1 2]) The residues are actually stored in vector format as -# r = [ A(1,1) A(2,1) A(2,2) ]. -# -# We then multiply both sides by Q(s). Continuing the example: -# -# s^2 = r(1)*(s+1)^2 + r(2)*(s+1)*(s+2) + r(3)*(s+2) -# -# or -# -# s^2 = r(1)*(s^2+2s+1) + r(2)*(s^2+3s+2) +r(3)*(s+2) -# -# The coefficients of the polynomials on the right are stored in a row -# vector called rhs, while the coefficients of the polynomial on the -# left is stored in a row vector called lhs. If the multiplicity of -# any root is greater than one we'll also need derivatives of this -# equation of order up to the maximum multiplicity minus one. The -# derivative coefficients are stored in successive rows of lhs and -# rhs. -# -# For our example lhs and rhs would be: -# -# | 1 0 0 | -# lhs = | | -# | 0 2 0 | -# -# | 1 2 1 1 3 2 0 1 2 | -# rhs = | | -# | 0 2 2 0 2 3 0 0 1 | -# -# We then form a vector B and a matrix A obtained by evaluating the -# polynomials in lhs and rhs at the pole values. If a pole has a -# multiplicity greater than one we also evaluate the derivative -# polynomials (successive rows) at the pole value. -# -# For our example we would have -# -# | 4| | 1 0 0 | | r(1) | -# | 1| = | 0 0 1 | * | r(2) | -# |-2| | 0 1 1 | | r(3) | -# -# We then solve for the residues using matrix division. + ## Here's the method used to find the residues. + ## The partial fraction expansion can be written as: + ## + ## + ## P(s) D M(k) A(k,m) + ## ---- = # # ------------- + ## Q(s) k=1 m=1 (s - pr(k))^m + ## + ## (# is used to represent a summation) where D is the number of + ## distinct roots, pr(k) is the kth distinct root, M(k) is the + ## multiplicity of the root, and A(k,m) is the residue cooresponding + ## to the kth distinct root with multiplicity m. For example, + ## + ## s^2 A(1,1) A(2,1) A(2,2) + ## ------------------- = ------ + ------ + ------- + ## s^3 + 4s^2 + 5s + 2 (s+2) (s+1) (s+1)^2 + ## + ## In this case there are two distinct roots (D=2 and pr = [-2 -1]), + ## the first root has multiplicity one and the second multiplicity + ## two (M = [1 2]) The residues are actually stored in vector format as + ## r = [ A(1,1) A(2,1) A(2,2) ]. + ## + ## We then multiply both sides by Q(s). Continuing the example: + ## + ## s^2 = r(1)*(s+1)^2 + r(2)*(s+1)*(s+2) + r(3)*(s+2) + ## + ## or + ## + ## s^2 = r(1)*(s^2+2s+1) + r(2)*(s^2+3s+2) +r(3)*(s+2) + ## + ## The coefficients of the polynomials on the right are stored in a row + ## vector called rhs, while the coefficients of the polynomial on the + ## left is stored in a row vector called lhs. If the multiplicity of + ## any root is greater than one we'll also need derivatives of this + ## equation of order up to the maximum multiplicity minus one. The + ## derivative coefficients are stored in successive rows of lhs and + ## rhs. + ## + ## For our example lhs and rhs would be: + ## + ## | 1 0 0 | + ## lhs = | | + ## | 0 2 0 | + ## + ## | 1 2 1 1 3 2 0 1 2 | + ## rhs = | | + ## | 0 2 2 0 2 3 0 0 1 | + ## + ## We then form a vector B and a matrix A obtained by evaluating the + ## polynomials in lhs and rhs at the pole values. If a pole has a + ## multiplicity greater than one we also evaluate the derivative + ## polynomials (successive rows) at the pole value. + ## + ## For our example we would have + ## + ## | 4| | 1 0 0 | | r(1) | + ## | 1| = | 0 0 1 | * | r(2) | + ## |-2| | 0 1 1 | | r(3) | + ## + ## We then solve for the residues using matrix division. if (nargin < 2 || nargin > 3) usage ("residue (b, a [, toler])"); @@ -134,7 +135,7 @@ toler = .001; endif -# Make sure both polynomials are in reduced form. + ## Make sure both polynomials are in reduced form. a = polyreduce (a); b = polyreduce (b); @@ -145,7 +146,7 @@ la = length (a); lb = length (b); -# Handle special cases here. + ## Handle special cases here. if (la == 0 || lb == 0) k = r = p = e = []; @@ -156,22 +157,22 @@ return; endif -# Find the poles. + ## Find the poles. p = roots (a); lp = length (p); -# Determine if the poles are (effectively) real. + ## Determine if the poles are (effectively) real. index = find (abs (imag (p) ./ real (p)) < toler); if (length (index) != 0) p (index) = real (p (index)); endif -# Find the direct term if there is one. + ## Find the direct term if there is one. if (lb >= la) -# Also returns the reduced numerator. + ## Also returns the reduced numerator. [k, b] = deconv (b, a); lb = length (b); else @@ -185,16 +186,16 @@ endif -# We need to determine the number and multiplicity of the roots. -# -# D is the number of distinct roots. -# M is a vector of length D containing the multiplicity of each root. -# pr is a vector of length D containing only the distinct roots. -# e is a vector of length lp which indicates the power in the partial -# fraction expansion of each term in p. + ## We need to determine the number and multiplicity of the roots. + ## + ## D is the number of distinct roots. + ## M is a vector of length D containing the multiplicity of each root. + ## pr is a vector of length D containing only the distinct roots. + ## e is a vector of length lp which indicates the power in the partial + ## fraction expansion of each term in p. -# Set initial values. We'll remove elements from pr as we find -# multiplicities. We'll shorten M afterwards. + ## Set initial values. We'll remove elements from pr as we find + ## multiplicities. We'll shorten M afterwards. e = ones (lp, 1); M = zeros (lp, 1); @@ -209,13 +210,13 @@ while (new_p_index <= lp) if (abs (p (new_p_index) - p (old_p_index)) < toler) -# We've found a multiple pole. + ## We've found a multiple pole. M (M_index) = M (M_index) + 1; e (new_p_index) = e (new_p_index-1) + 1; -# Remove the pole from pr. + ## Remove the pole from pr. pr (pr_index) = []; else -# It's a different pole. + ## It's a different pole. D++; M_index++; M (M_index) = 1; @@ -225,15 +226,15 @@ new_p_index++; endwhile -# Shorten M to it's proper length + ## Shorten M to it's proper length M = M (1:D); -# Now set up the polynomial matrices. + ## Now set up the polynomial matrices. MM = max(M); -# Left hand side polynomial + ## Left hand side polynomial lhs = zeros (MM, lb); rhs = zeros (MM, lp*lp); @@ -268,14 +269,14 @@ endfor endif -# Now lhs contains the numerator polynomial and as many derivatives as -# are required. rhs is a matrix of polynomials, the first row -# contains the corresponding polynomial for each residue and -# successive rows are derivatives. + ## Now lhs contains the numerator polynomial and as many derivatives as + ## are required. rhs is a matrix of polynomials, the first row + ## contains the corresponding polynomial for each residue and + ## successive rows are derivatives. -# Now we need to evaluate the first row of lhs and rhs at each -# distinct pole value. If there are multiple poles we will also need -# to evaluate the derivatives at the pole value also. + ## Now we need to evaluate the first row of lhs and rhs at each + ## distinct pole value. If there are multiple poles we will also need + ## to evaluate the derivatives at the pole value also. B = zeros (lp, 1); A = zeros (lp, lp); @@ -296,7 +297,7 @@ dpi++; endwhile -# Solve for the residues. + ## Solve for the residues. r = A \ B;
--- a/scripts/polynomial/roots.m +++ b/scripts/polynomial/roots.m @@ -1,30 +1,31 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function r = roots (v) -# usage: roots (v) -# -# For a vector v with n components, return the roots of the -# polynomial v(1) * z^(n-1) + ... + v(n-1) * z + v(n). + ## usage: roots (v) + ## + ## For a vector v with n components, return the roots of the + ## polynomial v(1) * z^(n-1) + ... + v(n-1) * z + v(n). -# Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Dec 24, 1993 -# Updated by KH on Nov 25, 1994 + ## Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Dec 24, 1993 + ## Updated by KH on Nov 25, 1994 if (min (size (v)) > 1 || nargin != 1) usage ("roots (v), where v is a vector"); @@ -33,8 +34,8 @@ n = length (v); v = reshape (v, 1, n); - # If v = [ 0 ... 0 v(k+1) ... v(k+l) 0 ... 0 ], we can remove the - # leading k zeros and n - k - l roots of the polynomial are zero. + ## If v = [ 0 ... 0 v(k+1) ... v(k+l) 0 ... 0 ], we can remove the + ## leading k zeros and n - k - l roots of the polynomial are zero. f = find (v); m = max (size (f));
--- a/scripts/set/complement.m +++ b/scripts/set/complement.m @@ -1,10 +1,29 @@ +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. + function y = complement (a, b) -# usage: complement (a, b) -# -# Returns the elements of set b that are not in set a. -# -# See - create_set, union, intersection + ## usage: complement (a, b) + ## + ## Returns the elements of set b that are not in set a. + ## + ## See - create_set, union, intersection if (nargin != 2) usage ("complement(a,b)");
--- a/scripts/set/create_set.m +++ b/scripts/set/create_set.m @@ -1,10 +1,29 @@ +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. + function y = create_set(x) -# usage: create_set(x) -# -# Returns the unique elements of x, sorted in ascending order. -# -# See - union, intersection, complement + ## usage: create_set(x) + ## + ## Returns the unique elements of x, sorted in ascending order. + ## + ## See - union, intersection, complement if ( nargin != 1) usage ("create_set(x)");
--- a/scripts/set/intersection.m +++ b/scripts/set/intersection.m @@ -1,10 +1,29 @@ +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. + function y = intersection(a,b) -# usage: intersection(a,b) -# -# Returns the intersection of sets a and b. -# -# See - create_set, union, complement + ## usage: intersection(a,b) + ## + ## Returns the intersection of sets a and b. + ## + ## See - create_set, union, complement if (nargin != 2) usage ("intersection(a,b)");
--- a/scripts/set/union.m +++ b/scripts/set/union.m @@ -1,10 +1,29 @@ +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. + function y = union(a,b) -# usage: union(a,b) -# -# Returns the union of sets a and b. -# -# See - create_set, intersection, complement + ## usage: union(a,b) + ## + ## Returns the union of sets a and b. + ## + ## See - create_set, intersection, complement if (nargin != 2) usage ("union(a,b)");
--- a/scripts/signal/fftconv.m +++ b/scripts/signal/fftconv.m @@ -1,34 +1,35 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function c = fftconv (a, b, N) -# usage: fftconv (a, b [, N]) -# -# c = fftconv (a, b) returns the convolution of the vectors a and b, -# a vector with length equal to length (a) + length (b) - 1. -# If a and b are the coefficient vectors of two polynomials, c is -# the coefficient vector of the product polynomial. -# -# The computation uses the FFT by calling fftfilt. If the optional -# argument N is specified, an N-point FFT is used. + ## usage: fftconv (a, b [, N]) + ## + ## c = fftconv (a, b) returns the convolution of the vectors a and b, + ## a vector with length equal to length (a) + length (b) - 1. + ## If a and b are the coefficient vectors of two polynomials, c is + ## the coefficient vector of the product polynomial. + ## + ## The computation uses the FFT by calling fftfilt. If the optional + ## argument N is specified, an N-point FFT is used. -# Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Sep 3, 1994. + ## Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Sep 3, 1994. if (nargin < 2 || nargin > 3) usage ("fftconv (b, x [, N])");
--- a/scripts/signal/fftfilt.m +++ b/scripts/signal/fftfilt.m @@ -1,39 +1,40 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function y = fftfilt (b, x, N) -# usage: fftfilt (b, x [, N]) -# -# y = fftfilt (b, x) filters x with the FIR filter b using the FFT. -# y = fftfilt (b, x, N) uses the overlap-add method to filter x with -# b using an N-point FFT. + ## usage: fftfilt (b, x [, N]) + ## + ## y = fftfilt (b, x) filters x with the FIR filter b using the FFT. + ## y = fftfilt (b, x, N) uses the overlap-add method to filter x with + ## b using an N-point FFT. -# Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Sep 3, 1994 + ## Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Sep 3, 1994 -# Reference: Oppenheim & Schafer (1989). Discrete-time Signal -# Processing (Chapter 8). Prentice-Hall. + ## Reference: Oppenheim & Schafer (1989). Discrete-time Signal + ## Processing (Chapter 8). Prentice-Hall. -# If N is not specified explicitly, we do not use the overlap-add -# method at all because loops are really slow. Otherwise, we only -# ensure that the number of points in the FFT is the smallest power -# of two larger than N and length(b). This could result in length -# one blocks, but if the user knows better ... + ## If N is not specified explicitly, we do not use the overlap-add + ## method at all because loops are really slow. Otherwise, we only + ## ensure that the number of points in the FFT is the smallest power + ## of two larger than N and length(b). This could result in length + ## one blocks, but if the user knows better ... if (nargin < 2 || nargin > 3) usage (" fftfilt (b, x [, N])"); @@ -56,12 +57,12 @@ b = reshape (b, 1, l_b); if (nargin == 2) -# Use FFT with the smallest power of 2 which is >= length (x) + -# length (b) - 1 as number of points ... + ## Use FFT with the smallest power of 2 which is >= length (x) + + ## length (b) - 1 as number of points ... N = 2^(ceil (log (l_x + l_b - 1) / log(2))); y = ifft (fft (x, N) .* fft(b, N)); else -# Use overlap-add method ... + ## Use overlap-add method ... if !(is_scalar (N)) error ("fftfilt: N has to be a scalar"); endif @@ -81,8 +82,8 @@ y = reshape (y(1:l_x), r_x, c_x); -# Final cleanups: if both x and b are real respectively integer, y -# should also be + ## Final cleanups: if both x and b are real respectively integer, y + ## should also be if (! (any (imag (x)) || any (imag (b)))) y = real (y);
--- a/scripts/signal/freqz.m +++ b/scripts/signal/freqz.m @@ -1,30 +1,49 @@ +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. + function [h, w] = freqz(b,...) -# Compute the frequency response of a filter. -# -# [h,w] = resp(b) -# returns the complex frequency response h of the FIR filter with -# coefficients b. The response is evaluated at 512 angular frequencies -# between 0 and pi. w is a vector containing the 512 frequencies. -# -# [h,w] = resp(b,a) -# returns the complex frequency response of the rational IIR filter -# whose numerator has coefficients b and denominator coefficients a. -# -# [h,w] = resp(b,a,n) -# returns the response evaluated at n angular frequencies. For fastest -# computation n should factor into a small number of small primes. -# -# [h,w] = freqz(b,a,n,"whole") -# evaluates the response at n frequencies between 0 and 2*pi. + ## Compute the frequency response of a filter. + ## + ## [h,w] = resp(b) + ## returns the complex frequency response h of the FIR filter with + ## coefficients b. The response is evaluated at 512 angular frequencies + ## between 0 and pi. w is a vector containing the 512 frequencies. + ## + ## [h,w] = resp(b,a) + ## returns the complex frequency response of the rational IIR filter + ## whose numerator has coefficients b and denominator coefficients a. + ## + ## [h,w] = resp(b,a,n) + ## returns the response evaluated at n angular frequencies. For fastest + ## computation n should factor into a small number of small primes. + ## + ## [h,w] = freqz(b,a,n,"whole") + ## evaluates the response at n frequencies between 0 and 2*pi. if (nargin == 1) - # Response of an FIR filter. + ## Response of an FIR filter. a = 1; n = 512; region = "half"; elseif (nargin == 2) - # Response of an IIR filter + ## Response of an IIR filter a = va_arg(); n = 512; region = "half";
--- a/scripts/signal/sinc.m +++ b/scripts/signal/sinc.m @@ -1,13 +1,32 @@ +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. + function result = sinc (x) -# usage: sinc(x) -# -# Returns sin(pi*x)/(pi*x). + ## usage: sinc(x) + ## + ## Returns sin(pi*x)/(pi*x). -# We either need to set the do_fortran_indexing variable to "true" -# or use reshape to convert the input matrix to a vector, so that -# we can use find to determine the elements of x that equal zero. -# I prefer reshaping. + ## We either need to set the do_fortran_indexing variable to "true" + ## or use reshape to convert the input matrix to a vector, so that + ## we can use find to determine the elements of x that equal zero. + ## I prefer reshaping. [nr, nc] = size(x); @@ -15,10 +34,10 @@ x = reshape(x,nels,1); -# Set result to all ones initially. + ## Set result to all ones initially. result = ones(nels,1); -# Find non-zero elements in the input matrix. + ## Find non-zero elements in the input matrix. i = find(x); if (!isempty(i))
--- a/scripts/specfun/beta.m +++ b/scripts/specfun/beta.m @@ -1,29 +1,30 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = beta (a, b) -# usage: beta (a, b) -# -# Returns the beta function beta(a,b) = gamma(a) * gamma(b) / gamma(a+b) -# of a and b. + ## usage: beta (a, b) + ## + ## Returns the beta function beta(a,b) = gamma(a) * gamma(b) / gamma(a+b) + ## of a and b. -# Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Jun 13, 1993 + ## Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Jun 13, 1993 if (nargin != 2) usage ("beta (a, b)");
--- a/scripts/specfun/betai.m +++ b/scripts/specfun/betai.m @@ -1,37 +1,38 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function y = betai (a, b, x) -# usage: betai (a, b, x) -# -# Returns the incomplete beta function -# betai (a, b, x) = BETA(a,b)^(-1) INT_0^x t^(a-1) (1-t)^(b-1) dt. -# If x has more than one component, both a and b must be scalars. -# If x is a scalar, a and b must be of compatible dimensions. + ## usage: betai (a, b, x) + ## + ## Returns the incomplete beta function + ## betai (a, b, x) = BETA(a,b)^(-1) INT_0^x t^(a-1) (1-t)^(b-1) dt. + ## If x has more than one component, both a and b must be scalars. + ## If x is a scalar, a and b must be of compatible dimensions. -# Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Aug 2, 1994. + ## Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Aug 2, 1994. -# Computation is based on the series expansion -# betai(a, b, x) -# = \frac{1}{B(a, b)} x^a -# \sum_{k=0}^\infty \frac{(1-b)\cdots(k-b)}{a+k} \frac{x^k}{k!} -# for x <= 1/2. For x > 1/2, betai(a, b, x) = 1 - betai(b, a, 1-x). + ## Computation is based on the series expansion + ## betai(a, b, x) + ## = \frac{1}{B(a, b)} x^a + ## \sum_{k=0}^\infty \frac{(1-b)\cdots(k-b)}{a+k} \frac{x^k}{k!} + ## for x <= 1/2. For x > 1/2, betai(a, b, x) = 1 - betai(b, a, 1-x). if (nargin <> 3) usage (" betai (a, b, x)"); @@ -61,8 +62,8 @@ y (find (x == 1)) = ones (1, sum (x == 1)); -# Now do the series computation. The error when truncating at term K -# is always less than 2^(-K), hence the following choice of K. + ## Now do the series computation. The error when truncating at term K + ## is always less than 2^(-K), hence the following choice of K. K = ceil (-log (eps) / log (2)); k = (1:K)';
--- a/scripts/specfun/betainc.m +++ b/scripts/specfun/betainc.m @@ -1,26 +1,27 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function y = betainc (x, a, b) -# Usage: betainc (x, a, b) -# -# See also: betai + ## Usage: betainc (x, a, b) + ## + ## See also: betai y = betai (a, b, x);
--- a/scripts/specfun/gammai.m +++ b/scripts/specfun/gammai.m @@ -1,37 +1,38 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function y = gammai (a, x) -# usage: gammai (a, x) -# -# Computes the incomplete gamma function -# -# gammai (a, x) -# = (integral from 0 to x of exp(-t) t^(a-1) dt) / gamma(a). -# -# If a is scalar, then gammai(a, x) is returned for each element of x -# and vice versa. -# -# If neither a nor x is scalar, the sizes of a and x must agree, and -# gammai is applied pointwise. + ## usage: gammai (a, x) + ## + ## Computes the incomplete gamma function + ## + ## gammai (a, x) + ## = (integral from 0 to x of exp(-t) t^(a-1) dt) / gamma(a). + ## + ## If a is scalar, then gammai(a, x) is returned for each element of x + ## and vice versa. + ## + ## If neither a nor x is scalar, the sizes of a and x must agree, and + ## gammai is applied pointwise. -# Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Aug 13, 1994 + ## Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Aug 13, 1994 if (nargin != 2) usage ("gammai (a, x)"); @@ -42,9 +43,9 @@ e_a = r_a * c_a; e_x = r_x * c_x; - # The following code is rather ugly. We want the function to work - # whenever a and x have the same size or a or x is scalar. - # We do this by reducing the latter cases to the former. + ## The following code is rather ugly. We want the function to work + ## whenever a and x have the same size or a or x is scalar. + ## We do this by reducing the latter cases to the former. if (e_a == 0 || e_x == 0) error ("gammai: both a and x must be nonempty"); @@ -71,7 +72,7 @@ error ("gammai: a and x must have the same size if neither is scalar"); endif -# Now we can do sanity checking ... + ## Now we can do sanity checking ... if (any (a <= 0) || any (a == Inf)) error ("gammai: all entries of a must be positive anf finite"); @@ -82,8 +83,8 @@ y = zeros (1, n); -# For x < a + 1, use summation. The below choice of k should ensure -# that the overall error is less than eps ... + ## For x < a + 1, use summation. The below choice of k should ensure + ## that the overall error is less than eps ... S = find ((x > 0) & (x < a + 1)); s = length (S); @@ -95,9 +96,9 @@ y(S) = exp (-x(S) + a(S) .* log (x(S))) .* (1 + sum (A)) ./ gamma (a(S)+1); endif -# For x >= a + 1, use the continued fraction. -# Note, however, that this converges MUCH slower than the series -# expansion for small a and x not too large! + ## For x >= a + 1, use the continued fraction. + ## Note, however, that this converges MUCH slower than the series + ## expansion for small a and x not too large! S = find ((x >= a + 1) & (x < Inf)); s = length (S);
--- a/scripts/specfun/gammainc.m +++ b/scripts/specfun/gammainc.m @@ -1,26 +1,27 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function y = gammainc (x, a) -# Usage: gammainc (x, a) -# -# See also: gammai + ## Usage: gammainc (x, a) + ## + ## See also: gammai y = gammai (a, x);
--- a/scripts/special-matrix/hadamard.m +++ b/scripts/special-matrix/hadamard.m @@ -1,28 +1,29 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = hadamard (k) -# usage: hadamard (k) -# -# Return the Hadamard matrix of order n = 2^k. -# -# See also: hankel, vander, hilb, invhilb, toeplitz + ## usage: hadamard (k) + ## + ## Return the Hadamard matrix of order n = 2^k. + ## + ## See also: hankel, vander, hilb, invhilb, toeplitz if (nargin != 1) usage ("hadamard (n)");
--- a/scripts/special-matrix/hankel.m +++ b/scripts/special-matrix/hankel.m @@ -1,33 +1,34 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = hankel (c, r) -# usage: hankel (c, r) -# -# Return the Hankel matrix constructed given the first column -# c, and (optionally) the last row r. -# -# If the second argument is omitted, zeros are inserted below the main -# anti-diagonal. If the last element of c is not the same as the first -# element of r, the last element of c is used. -# -# See also: vander, hadamard, hilb, invhilb, toeplitz + ## usage: hankel (c, r) + ## + ## Return the Hankel matrix constructed given the first column + ## c, and (optionally) the last row r. + ## + ## If the second argument is omitted, zeros are inserted below the main + ## anti-diagonal. If the last element of c is not the same as the first + ## element of r, the last element of c is used. + ## + ## See also: vander, hadamard, hilb, invhilb, toeplitz if (nargin == 1) r = zeros (size (c)); @@ -61,7 +62,7 @@ warning ("hankel: column wins anti-diagonal conflict"); endif -# This should probably be done with the colon operator... + ## This should probably be done with the colon operator... retval = zeros (nr, nc);
--- a/scripts/special-matrix/hilb.m +++ b/scripts/special-matrix/hilb.m @@ -1,31 +1,32 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = hilb (n) -# usage: hilb (n) -# -# Return the Hilbert matrix of order n. The i, j element of a Hilbert -# matrix is defined as -# -# H (i, j) = 1 / (i + j - 1); -# -# See also: hankel, vander, hadamard, invhilb, toeplitz + ## usage: hilb (n) + ## + ## Return the Hilbert matrix of order n. The i, j element of a Hilbert + ## matrix is defined as + ## + ## H (i, j) = 1 / (i + j - 1); + ## + ## See also: hankel, vander, hadamard, invhilb, toeplitz if (nargin != 1)
--- a/scripts/special-matrix/invhilb.m +++ b/scripts/special-matrix/invhilb.m @@ -1,29 +1,30 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = invhilb (n) -# usage: invhilb (n) -# -# Return the inverse of a Hilbert matrix of order n. This is slow but -# exact. Compare with inv (hilb (n)). -# -# See also: hankel, vander, hadamard, hilb, toeplitz + ## usage: invhilb (n) + ## + ## Return the inverse of a Hilbert matrix of order n. This is slow but + ## exact. Compare with inv (hilb (n)). + ## + ## See also: hankel, vander, hadamard, hilb, toeplitz if (nargin != 1) usage ("invhilb (n)");
--- a/scripts/special-matrix/toeplitz.m +++ b/scripts/special-matrix/toeplitz.m @@ -1,33 +1,34 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = toeplitz (c, r) -# usage: toeplitz (c, r) -# -# Return the Toeplitz matrix constructed given the first column -# c, and (optionally) the first row r. -# -# If the second argument is omitted, the first row is taken to be the -# same as the first column. If the first element of c is not the same -# as the first element of r, the first element of c is used. -# -# See also: hankel, vander, hadamard, hilb, invhib + ## usage: toeplitz (c, r) + ## + ## Return the Toeplitz matrix constructed given the first column + ## c, and (optionally) the first row r. + ## + ## If the second argument is omitted, the first row is taken to be the + ## same as the first column. If the first element of c is not the same + ## as the first element of r, the first element of c is used. + ## + ## See also: hankel, vander, hadamard, hilb, invhib if (nargin == 1) r = c; @@ -54,16 +55,16 @@ warning ("toeplitz: column wins diagonal conflict"); endif -# If we have a single complex argument, we want to return a -# Hermitian-symmetric matrix (actually, this will really only be -# Hermitian-symmetric if the first element of the vector is real). + ## If we have a single complex argument, we want to return a + ## Hermitian-symmetric matrix (actually, this will really only be + ## Hermitian-symmetric if the first element of the vector is real). if (nargin == 1) c = conj (c); c(1) = conj (c(1)); endif -# This should probably be done with the colon operator... + ## This should probably be done with the colon operator... nc = length (r); nr = length (c);
--- a/scripts/special-matrix/vander.m +++ b/scripts/special-matrix/vander.m @@ -1,28 +1,29 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = vander (c) -# usage: vander (c) -# -# Return the Vandermonde matrix whose next to last column is c. -# -# See also: hankel, hadamard, hilb, invhilb, toeplitz + ## usage: vander (c) + ## + ## Return the Vandermonde matrix whose next to last column is c. + ## + ## See also: hankel, hadamard, hilb, invhilb, toeplitz if (nargin != 1) usage ("vander (c)");
--- a/scripts/statistics/corrcoef.m +++ b/scripts/statistics/corrcoef.m @@ -1,32 +1,33 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = corrcoef (X, Y) -# usage: corrcoef (X [, Y]) -# -# If each row of X and Y is an observation and each column is a variable, -# the (i,j)-th entry of corrcoef(X, Y) is the correlation between the -# i-th variable in X and the j-th variable in Y. -# corrcoef(X) is corrcoef(X, X). + ## usage: corrcoef (X [, Y]) + ## + ## If each row of X and Y is an observation and each column is a variable, + ## the (i,j)-th entry of corrcoef(X, Y) is the correlation between the + ## i-th variable in X and the j-th variable in Y. + ## corrcoef(X) is corrcoef(X, X). -# Written by Kurt Hornik (hornik@ci.tuwien.ac.at) March 1993. -# Dept of Probability Theory and Statistics TU Wien, Austria. + ## Written by Kurt Hornik (hornik@ci.tuwien.ac.at) March 1993. + ## Dept of Probability Theory and Statistics TU Wien, Austria. if (nargin < 1 || nargin > 2) usage ("corrcoef (X [, Y])");
--- a/scripts/statistics/cov.m +++ b/scripts/statistics/cov.m @@ -1,32 +1,33 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = cov (X, Y) -# usage: cov (X [, Y]) -# -# If each row of X and Y is an observation and each column is a -# variable, the (i,j)-th entry of cov(X, Y) is the covariance -# between the i-th variable in X and the j-th variable in Y. -# cov(X) is cov(X, X). + ## usage: cov (X [, Y]) + ## + ## If each row of X and Y is an observation and each column is a + ## variable, the (i,j)-th entry of cov(X, Y) is the covariance + ## between the i-th variable in X and the j-th variable in Y. + ## cov(X) is cov(X, X). -# Written by Kurt Hornik (hornik@ci.tuwien.ac.at) March 1993. -# Dept of Probability Theory and Statistics TU Wien, Austria. + ## Written by Kurt Hornik (hornik@ci.tuwien.ac.at) March 1993. + ## Dept of Probability Theory and Statistics TU Wien, Austria. if (nargin < 1 || nargin > 2) usage ("cov (X [, Y])");
--- a/scripts/statistics/gls.m +++ b/scripts/statistics/gls.m @@ -1,41 +1,42 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function [BETA, v, R] = gls (Y, X, O) -# usage: [BETA, v [,R]] = gls (Y, X, O) -# -# Generalized Least Squares (GLS) estimation for the multivariate model -# -# Y = X*B + E, mean(E) = 0, cov(vec(E)) = (s^2)*O -# -# with Y ... T x p As usual, each row of Y and X is an observation -# X ... T x k and each column a variable. -# B ... k x p -# E ... T x p -# O ... Tp x Tp. -# -# BETA is the GLS estimator for B. -# v is the GLS estimator for s^2. -# R = Y - X*BETA is the matrix of GLS residuals. + ## usage: [BETA, v [,R]] = gls (Y, X, O) + ## + ## Generalized Least Squares (GLS) estimation for the multivariate model + ## + ## Y = X*B + E, mean(E) = 0, cov(vec(E)) = (s^2)*O + ## + ## with Y ... T x p As usual, each row of Y and X is an observation + ## X ... T x k and each column a variable. + ## B ... k x p + ## E ... T x p + ## O ... Tp x Tp. + ## + ## BETA is the GLS estimator for B. + ## v is the GLS estimator for s^2. + ## R = Y - X*BETA is the matrix of GLS residuals. -# Written by Teresa Twaroch (twaroch@ci.tuwien.ac.at) May 1993. -# Dept of Probability Theory and Statistics TU Wien, Austria. + ## Written by Teresa Twaroch (twaroch@ci.tuwien.ac.at) May 1993. + ## Dept of Probability Theory and Statistics TU Wien, Austria. if (nargin != 3) usage ("[BETA, v [, R]] = gls (Y, X, O)");
--- a/scripts/statistics/kurtosis.m +++ b/scripts/statistics/kurtosis.m @@ -1,35 +1,36 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = kurtosis (x) -# usage: kurtosis (x) -# -# If x is a vector of length N, return the kurtosis -# -# kurtosis(x) = N^(-1) std(x)^(-4) SUM_i (x(i)-mean(x))^4 - 3 -# -# of x. -# -# If x is a matrix, return a row vector containing the kurtosis for each -# column. + ## usage: kurtosis (x) + ## + ## If x is a vector of length N, return the kurtosis + ## + ## kurtosis(x) = N^(-1) std(x)^(-4) SUM_i (x(i)-mean(x))^4 - 3 + ## + ## of x. + ## + ## If x is a matrix, return a row vector containing the kurtosis for each + ## column. -# Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Jul 29, 1994. + ## Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Jul 29, 1994. if (nargin != 1) usage ("kurtosis (x)");
--- a/scripts/statistics/mahalanobis.m +++ b/scripts/statistics/mahalanobis.m @@ -1,31 +1,32 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = mahalanobis (X, Y) -# usage: mahalanobis (X, Y) -# -# Returns Mahalanobis' D-square distance between the multivariate -# samples X and Y, which must have the same number of components -# (columns), but may have a different number of observations (rows). + ## usage: mahalanobis (X, Y) + ## + ## Returns Mahalanobis' D-square distance between the multivariate + ## samples X and Y, which must have the same number of components + ## (columns), but may have a different number of observations (rows). -# Written by Friedrich Leisch (leisch@ci.tuwien.ac.at) July 1993. -# Dept of Probability Theory and Statistics TU Wien, Austria. + ## Written by Friedrich Leisch (leisch@ci.tuwien.ac.at) July 1993. + ## Dept of Probability Theory and Statistics TU Wien, Austria. if (nargin != 2) usage ("mahalanobis (X, Y)");
--- a/scripts/statistics/mean.m +++ b/scripts/statistics/mean.m @@ -1,31 +1,32 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = mean (a) -# usage: mean (a) -# -# For vector arguments, return the mean the values. -# -# For matrix arguments, return a row vector containing the mean for -# each column. -# -# See also: median, std + ## usage: mean (a) + ## + ## For vector arguments, return the mean the values. + ## + ## For matrix arguments, return a row vector containing the mean for + ## each column. + ## + ## See also: median, std if (nargin != 1) usage ("mean (a)");
--- a/scripts/statistics/median.m +++ b/scripts/statistics/median.m @@ -1,31 +1,32 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = median (a) -# usage: median (a) -# -# For vector arguments, return the median of the values. -# -# For matrix arguments, return a row vector containing the median for -# each column. -# -# See also: std, mean + ## usage: median (a) + ## + ## For vector arguments, return the median of the values. + ## + ## For matrix arguments, return a row vector containing the median for + ## each column. + ## + ## See also: std, mean if (nargin != 1) usage ("median (a)");
--- a/scripts/statistics/ols.m +++ b/scripts/statistics/ols.m @@ -1,47 +1,48 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function [BETA, SIGMA, R] = ols (Y, X) -# usage: [BETA, SIGMA [, R]] = ols (Y, X) -# -# Ordinary Least Squares (OLS) estimation for the multivariate model -# -# Y = X*B + E, mean(E) = 0, cov(vec(E)) = kron(S,I) -# -# with Y ... T x p As usual, each row of Y and X is an observation -# X ... T x k and each column a variable. -# B ... k x p -# E ... T x p. -# -# BETA is the OLS estimator for B, i.e. -# -# BETA = pinv(X)*Y, -# -# where pinv(X) denotes the pseudoinverse of X. -# SIGMA is the OLS estimator for the matrix S, i.e. -# -# SIGMA = (Y - X*BETA)'*(Y - X*BETA) / (T - rank(X)). -# -# R = Y - X*BETA is the matrix of OLS residuals. + ## usage: [BETA, SIGMA [, R]] = ols (Y, X) + ## + ## Ordinary Least Squares (OLS) estimation for the multivariate model + ## + ## Y = X*B + E, mean(E) = 0, cov(vec(E)) = kron(S,I) + ## + ## with Y ... T x p As usual, each row of Y and X is an observation + ## X ... T x k and each column a variable. + ## B ... k x p + ## E ... T x p. + ## + ## BETA is the OLS estimator for B, i.e. + ## + ## BETA = pinv(X)*Y, + ## + ## where pinv(X) denotes the pseudoinverse of X. + ## SIGMA is the OLS estimator for the matrix S, i.e. + ## + ## SIGMA = (Y - X*BETA)'*(Y - X*BETA) / (T - rank(X)). + ## + ## R = Y - X*BETA is the matrix of OLS residuals. -# Written by Teresa Twaroch (twaroch@ci.tuwien.ac.at) May 1993. -# Dept of Probability Theory and Statistics TU Wien, Austria. + ## Written by Teresa Twaroch (twaroch@ci.tuwien.ac.at) May 1993. + ## Dept of Probability Theory and Statistics TU Wien, Austria. if (nargin != 2) error("usage : [BETA, SIGMA [, R]] = ols (Y, X)");
--- a/scripts/statistics/skewness.m +++ b/scripts/statistics/skewness.m @@ -1,35 +1,36 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = skewness (x) -# usage: skewness (x) -# -# If x is a vector of length N, return the skewness -# -# skewness (x) = N^(-1) std(x)^(-3) SUM_i (x(i)-mean(x))^3 -# -# of x. -# -# If x is a matrix, return a row vector containing the skewness for each -# column. + ## usage: skewness (x) + ## + ## If x is a vector of length N, return the skewness + ## + ## skewness (x) = N^(-1) std(x)^(-3) SUM_i (x(i)-mean(x))^3 + ## + ## of x. + ## + ## If x is a matrix, return a row vector containing the skewness for each + ## column. -# Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Jul 29, 1994. + ## Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Jul 29, 1994. if (nargin != 1) usage ("skewness (x)");
--- a/scripts/statistics/std.m +++ b/scripts/statistics/std.m @@ -1,30 +1,31 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = std (a) -# usage: std (a) -# -# For vector arguments, std returns the standard deviation of the -# values. For matrix arguments, std returns a row vector containing -# the standard deviation for each column. -# -# See also: mean, median + ## usage: std (a) + ## + ## For vector arguments, std returns the standard deviation of the + ## values. For matrix arguments, std returns a row vector containing + ## the standard deviation for each column. + ## + ## See also: mean, median if (nargin != 1) usage ("std (a)");
--- a/scripts/strings/bin2dec.m +++ b/scripts/strings/bin2dec.m @@ -1,29 +1,30 @@ -# Copyright (C) 1996 Kurt Hornik -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 Kurt Hornik +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function y = bin2dec (x) -# usage: bin2dec (x) -# -# Returns the decimal number corresponding to the binary number in -# quotes. For example, bin2dec ("1110") returns 14. + ## usage: bin2dec (x) + ## + ## Returns the decimal number corresponding to the binary number in + ## quotes. For example, bin2dec ("1110") returns 14. -# Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>. + ## Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>. if (nargin != 1) usage ("bin2dec (x)");
--- a/scripts/strings/blanks.m +++ b/scripts/strings/blanks.m @@ -1,28 +1,29 @@ -# Copyright (C) 1996 Kurt Hornik -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 Kurt Hornik +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function s = blanks (n) -# usage: blanks (n) -# -# Returns a string of n blanks. + ## usage: blanks (n) + ## + ## Returns a string of n blanks. -# Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>. + ## Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>. if (nargin != 1) usage ("blanks (n)");
--- a/scripts/strings/deblank.m +++ b/scripts/strings/deblank.m @@ -1,28 +1,29 @@ -# Copyright (C) 1996 Kurt Hornik -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 Kurt Hornik +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function t = deblank (s) -# usage: deblank (s) -# -# Remove trailing blanks from the string s. + ## usage: deblank (s) + ## + ## Remove trailing blanks from the string s. -# Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>. + ## Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>. if (nargin != 1) usage ("deblank (s)");
--- a/scripts/strings/dec2bin.m +++ b/scripts/strings/dec2bin.m @@ -1,29 +1,30 @@ -# Copyright (C) 1996 Kurt Hornik -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 Kurt Hornik +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function y = dec2bin (x) -# usage: dec2bin (x) -# -# Returns the binary number corresponding to the nonnegative integer -# x. For example, dec2bin (14) returns "1110". + ## usage: dec2bin (x) + ## + ## Returns the binary number corresponding to the nonnegative integer + ## x. For example, dec2bin (14) returns "1110". -# Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>. + ## Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>. if (nargin != 1) usage ("dec2bin (x)");
--- a/scripts/strings/dec2hex.m +++ b/scripts/strings/dec2hex.m @@ -1,29 +1,30 @@ -# Copyright (C) 1996 Kurt Hornik -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 Kurt Hornik +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function h = dec2hex (d) -# usage: dec2hex (d) -# -# Returns the hex number corresponding to the decimal number d. For -# example, dec2hex (2748) returns "abc". + ## usage: dec2hex (d) + ## + ## Returns the hex number corresponding to the decimal number d. For + ## example, dec2hex (2748) returns "abc". -# Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>. + ## Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>. if (nargin != 1) usage ("dec2hex (d)");
--- a/scripts/strings/findstr.m +++ b/scripts/strings/findstr.m @@ -1,37 +1,38 @@ -# Copyright (C) 1996 Kurt Hornik -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 Kurt Hornik +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function v = findstr (s, t, overlap) -# usage: findstr (s, t [, overlap]) -# -# Returns the vector of all positions in the longer of the two strings -# S and T where an occurence of the shorter of the two starts. -# -# If the optional argument OVERLAP is nonzero, the returned vector -# can include overlapping positions (this is the default). -# -# For example, -# -# findstr ("abababa", "aba") => [1, 3, 5] -# findstr ("abababa", "aba", 0) => [1, 5] + ## usage: findstr (s, t [, overlap]) + ## + ## Returns the vector of all positions in the longer of the two strings + ## S and T where an occurence of the shorter of the two starts. + ## + ## If the optional argument OVERLAP is nonzero, the returned vector + ## can include overlapping positions (this is the default). + ## + ## For example, + ## + ## findstr ("abababa", "aba") => [1, 3, 5] + ## findstr ("abababa", "aba", 0) => [1, 5] -# Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>. + ## Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>. if (nargin < 2 || nargin > 3) usage ("findstr (s, t [, overlap])"); @@ -43,7 +44,7 @@ if (isstr (s) && isstr (t)) - # Make S be the longer string. + ## Make S be the longer string. if (length (s) < length (t)) tmp = s;
--- a/scripts/strings/hex2dec.m +++ b/scripts/strings/hex2dec.m @@ -1,30 +1,31 @@ -# Copyright (C) 1996 Kurt Hornik -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 Kurt Hornik +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function d = hex2dec (h) -# usage: hex2dec (h) -# -# Returns the decimal number corresponding to the hex number in -# quotes. For example, hex2dec ("12B") and hex2dec ("12b") both -# return 299. + ## usage: hex2dec (h) + ## + ## Returns the decimal number corresponding to the hex number in + ## quotes. For example, hex2dec ("12B") and hex2dec ("12b") both + ## return 299. -# Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>. + ## Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>. if (nargin != 1) usage ("hex2dec (x)");
--- a/scripts/strings/index.m +++ b/scripts/strings/index.m @@ -1,33 +1,34 @@ -# Copyright (C) 1996 Kurt Hornik -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 Kurt Hornik +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function n = index (s, t) -# usage: index (s, t) -# -# Returns the position of the first occurence of the string T in the -# string S or 0 if no occurence is found. -# -# NOTE: this function does not work for arrays of strings. + ## usage: index (s, t) + ## + ## Returns the position of the first occurence of the string T in the + ## string S or 0 if no occurence is found. + ## + ## NOTE: this function does not work for arrays of strings. -# This is patterned after the AWK function of the same name. + ## This is patterned after the AWK function of the same name. -# Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>. + ## Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>. if (nargin != 2) usage ("index (s, t)");
--- a/scripts/strings/rindex.m +++ b/scripts/strings/rindex.m @@ -1,33 +1,34 @@ -# Copyright (C) 1996 Kurt Hornik -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 Kurt Hornik +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function n = rindex (s, t) -# usage: rindex (s, t) -# -# Returns the position of the last occurence of the string T in the -# string S or 0 if no occurence is found. -# -# NOTE: this function does not work for arrays of strings. + ## usage: rindex (s, t) + ## + ## Returns the position of the last occurence of the string T in the + ## string S or 0 if no occurence is found. + ## + ## NOTE: this function does not work for arrays of strings. -# This is patterned after the AWK function of the same name. + ## This is patterned after the AWK function of the same name. -# Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>. + ## Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>. if (nargin != 2) usage ("rindex (s, t)");
--- a/scripts/strings/split.m +++ b/scripts/strings/split.m @@ -1,30 +1,31 @@ -# Copyright (C) 1996 Kurt Hornik -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 Kurt Hornik +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function m = split (s, t) -# usage: m = split (s, t) -# -# Divides the string S into pieces separated by T, and stores the -# pieces as the rows of M (padded with blanks to form a valid -# matrix). + ## usage: m = split (s, t) + ## + ## Divides the string S into pieces separated by T, and stores the + ## pieces as the rows of M (padded with blanks to form a valid + ## matrix). -# Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>. + ## Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>. if (nargin != 2) usage ("split (s, t)");
--- a/scripts/strings/str2mat.m +++ b/scripts/strings/str2mat.m @@ -1,29 +1,30 @@ -# Copyright (C) 1996 Kurt Hornik -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 Kurt Hornik +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function m = str2mat (...) -# usage: m = str2mat (s1, ...) -# -# Forms the matrix M containing the strings S1, ... as its rows. -# Each string is padded with blanks in order to form a valid matrix. + ## usage: m = str2mat (s1, ...) + ## + ## Forms the matrix M containing the strings S1, ... as its rows. + ## Each string is padded with blanks in order to form a valid matrix. -# Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>. + ## Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>. if (nargin == 0) usage ("str2mat (s1, ...)");
--- a/scripts/strings/strcat.m +++ b/scripts/strings/strcat.m @@ -1,20 +1,21 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function st = strcat (s, t, ...)
--- a/scripts/strings/strcmp.m +++ b/scripts/strings/strcmp.m @@ -1,34 +1,35 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function status = strcmp (s1, s2) -# usage: strcmp (s1, s2) -# -# Compare two strings. Trailing blanks are significant. -# -# WARNING: Unlike the C function of the same name, this function -# returns 1 for equal and zero for not equal. Why? To be compatible -# with Matlab, of course. -# -# Why doesn't this always return a scalar instead of vector with -# elements corresponding to the rows of the string array? To be -# compatible with Matlab, of course. + ## usage: strcmp (s1, s2) + ## + ## Compare two strings. Trailing blanks are significant. + ## + ## WARNING: Unlike the C function of the same name, this function + ## returns 1 for equal and zero for not equal. Why? To be compatible + ## with Matlab, of course. + ## + ## Why doesn't this always return a scalar instead of vector with + ## elements corresponding to the rows of the string array? To be + ## compatible with Matlab, of course. if (nargin != 2) usage ("strcmp (s, t)");
--- a/scripts/strings/strrep.m +++ b/scripts/strings/strrep.m @@ -1,28 +1,31 @@ -# Copyright (C) 1995, 1996 Kurt Hornik -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this file. If not, write to the Free Software Foundation, -# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1995, 1996 Kurt Hornik +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function t = strrep (s, x, y) -# usage: strrep (s, x, y) -# -# Replace all occurences of the substring x of the string s with the -# string y. + ## usage: strrep (s, x, y) + ## + ## Replace all occurences of the substring x of the string s with the + ## string y. -# Written by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at> on 1994/10/11 -# Updated by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at> on 1996/05/25 + ## Written by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at> on 1994/10/11 + ## Updated by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at> on 1996/05/25 if (nargin <> 3) usage ("strrep (s, x, y)");
--- a/scripts/strings/substr.m +++ b/scripts/strings/substr.m @@ -1,29 +1,30 @@ -# Copyright (C) 1996 Kurt Hornik -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 Kurt Hornik +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function t = substr (s, beg, len) -# usage: substr (s, beg, len) -# -# Returns the substring of S of length LEN starting at index BEG. -# If LEN is missing, the substring extends to the end of S. + ## usage: substr (s, beg, len) + ## + ## Returns the substring of S of length LEN starting at index BEG. + ## If LEN is missing, the substring extends to the end of S. -# Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>. + ## Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>. if (nargin < 2 || nargin > 3) usage ("substr (s, beg, len)");
--- a/scripts/time/asctime.m +++ b/scripts/time/asctime.m @@ -1,24 +1,25 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = asctime (t) -# usage: asctime (TMSTRUCT) + ## usage: asctime (TMSTRUCT) if (nargin == 1) retval = strftime ("%a %b %d %H:%M:%S %Y\n", t);
--- a/scripts/time/clock.m +++ b/scripts/time/clock.m @@ -1,28 +1,29 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = clock () -# usage: clock () -# -# Return current date and time in vector with elements -# -# [ year, month, day-of-month, hour, minute, second ] + ## usage: clock () + ## + ## Return current date and time in vector with elements + ## + ## [ year, month, day-of-month, hour, minute, second ] tm = localtime (time ());
--- a/scripts/time/ctime.m +++ b/scripts/time/ctime.m @@ -1,24 +1,25 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = ctime (t) -# usage: ctime (TIME) + ## usage: ctime (TIME) if (nargin == 1) retval = asctime (localtime (t));
--- a/scripts/time/date.m +++ b/scripts/time/date.m @@ -1,26 +1,27 @@ -# Copyright (C) 1996 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### Copyright (C) 1996 John W. Eaton +### +### This file is part of Octave. +### +### Octave is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2, or (at your option) +### any later version. +### +### Octave is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with Octave; see the file COPYING. If not, write to the Free +### Software Foundation, 59 Temple Place - Suite 330, Boston, MA +### 02111-1307, USA. function retval = date () -# usage: date () -# -# Return current date in a string, in the form `18-Jul-94'. + ## usage: date () + ## + ## Return current date in a string, in the form `18-Jul-94'. retval = strftime ("%d-%b-%y", localtime (time ()));