Mercurial > hg > octave-lyh
changeset 2311:2b5788792cad
[project @ 1996-07-11 20:18:38 by jwe]
line wrap: on
line diff
--- a/scripts/audio/lin2mu.m +++ b/scripts/audio/lin2mu.m @@ -17,13 +17,13 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## 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. + 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. - ## Written by AW (Andreas.Weingessel@ci.tuwien.ac.at) on Oct 17, 1994 ## Copyright Department of Probability Theory and Statistics TU Wien
--- a/scripts/audio/loadaudio.m +++ b/scripts/audio/loadaudio.m @@ -17,23 +17,23 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## 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. + 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. - ## Written by AW (Andreas.Weingessel@ci.tuwien.ac.at) on Apr 10, 1994 ## Last modified by AW on Oct 29, 1994
--- a/scripts/audio/mu2lin.m +++ b/scripts/audio/mu2lin.m @@ -17,15 +17,15 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## 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. + 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. - ## 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
--- a/scripts/audio/playaudio.m +++ b/scripts/audio/playaudio.m @@ -17,22 +17,22 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## 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. + 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. - ## 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
--- a/scripts/audio/record.m +++ b/scripts/audio/record.m @@ -17,14 +17,14 @@ ### 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. +function X = record (sec, sampling_rate) ## Written by AW (Andreas.Weingessel@ci.tuwien.ac.at) on Sep 19, 1994 ## Last modified by AW on Oct 5, 1994
--- a/scripts/audio/saveaudio.m +++ b/scripts/audio/saveaudio.m @@ -17,20 +17,20 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## usage: saveaudio (name, X, [, ext [, bit]]) +## +## Saves a vector X of audio data in the file "name.ext". +## The format of the audio file is determined by ext which has to be +## written without an inital "."; default value for ext is "lin". +## +## Currently, the following audio formats are supported: +## *) mu-law files with extension "mu", "au" or "snd" +## *) linearly encoded files with extension "lin" or "raw" +## If the data is saved linearly, the bit argument decides whether an +## 8-bit (default) or a 16-bit format is used. + function saveaudio (name, X, ext, bit) - ## usage: saveaudio (name, X, [, ext [, bit]]) - ## - ## Saves a vector X of audio data in the file "name.ext". - ## The format of the audio file is determined by ext which has to be - ## written without an inital "."; default value for ext is "lin". - ## - ## Currently, the following audio formats are supported: - ## *) mu-law files with extension "mu", "au" or "snd" - ## *) linearly encoded files with extension "lin" or "raw" - ## If the data is saved linearly, the bit argument decides whether an - ## 8-bit (default) or a 16-bit format is used. - ## Written by AW (Andreas.Weingessel@ci.tuwien.ac.at) on Sep 5, 1994 ## Last modified by AW on Oct 29, 1994 ## Copyright Dept of Probability Theory and Statistics TU Wien
--- a/scripts/audio/setaudio.m +++ b/scripts/audio/setaudio.m @@ -17,12 +17,12 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## usage: setaudio ([w_type [, value]]) +## +## executes the shell command `mixer [w_type [, value]]' + function setaudio (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
--- a/scripts/control/abcddim.m +++ b/scripts/control/abcddim.m @@ -17,18 +17,18 @@ ### 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. +function [n, m, p] = abcddim (a, b, c, d) ## Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993.
--- a/scripts/control/are.m +++ b/scripts/control/are.m @@ -17,23 +17,23 @@ ### 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 +function x = are (a, b, c, opt) ## Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993.
--- a/scripts/control/c2d.m +++ b/scripts/control/c2d.m @@ -17,19 +17,19 @@ ### 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. +function [Ad, Bd] = c2d (Ac, Bc, T) ## Written by R.B. Tenison (btenison@eng.auburn.edu) ## October 1993
--- a/scripts/control/dare.m +++ b/scripts/control/dare.m @@ -17,34 +17,34 @@ ### 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 +function x = dare (a, b, c, r, opt) ## Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993.
--- a/scripts/control/dgram.m +++ b/scripts/control/dgram.m @@ -17,14 +17,14 @@ ### 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. +function gramian = dgram (A, B) ## Written by R. Bruce Tenison (btenison@eng.auburn.edu) ## October 1993
--- a/scripts/control/dlqe.m +++ b/scripts/control/dlqe.m @@ -17,30 +17,30 @@ ### 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) +function [l, m, p, e] = dlqe (a, g, c, sigw, sigv, zz) ## Written by A. S. Hodel (scotte@eng.auburn.edu) August, 1993. ## Modified for discrete time by R. Bruce Tenison (btenison@eng.auburn.edu)
--- a/scripts/control/dlqr.m +++ b/scripts/control/dlqr.m @@ -17,27 +17,27 @@ ### 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) +function [k, p, e] = dlqr (a, b, q, r, zz) ## Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993. ## Converted to discrete time by R. B. Tenison
--- a/scripts/control/dlyap.m +++ b/scripts/control/dlyap.m @@ -17,22 +17,22 @@ ### 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). +function x = dlyap (a, b) ## Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993.
--- a/scripts/control/is_controllable.m +++ b/scripts/control/is_controllable.m @@ -17,25 +17,25 @@ ### 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. +function retval = is_controllable (a, b, tol) ## Written by A. S. Hodel (scotte@eng.auburn.edu) August, 1993.
--- a/scripts/control/is_observable.m +++ b/scripts/control/is_observable.m @@ -17,13 +17,13 @@ ### 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. +function retval = is_observable (a,c,tol) ## Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993.
--- a/scripts/control/lqe.m +++ b/scripts/control/lqe.m @@ -17,28 +17,28 @@ ### 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) +function [k, p, e] = lqe (a, g, c, sigw, sigv, zz) ## Written by A. S. Hodel (scotte@eng.auburn.edu) August, 1993.
--- a/scripts/control/lqr.m +++ b/scripts/control/lqr.m @@ -17,27 +17,27 @@ ### 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) +function [k, p, e] = lqr (a, b, q, r, zz) ## Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993.
--- a/scripts/control/lyap.m +++ b/scripts/control/lyap.m @@ -17,31 +17,31 @@ ### 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). +function x = lyap (a, b, c) ## Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993.
--- a/scripts/control/tzero.m +++ b/scripts/control/tzero.m @@ -17,15 +17,15 @@ ### 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. +function zr = tzero (a, b, c, d, bal) ## Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993.
--- a/scripts/elfun/acot.m +++ b/scripts/elfun/acot.m @@ -17,9 +17,9 @@ ### 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. +function w = acot (z) if (nargin != 1) usage ("acot (z)");
--- a/scripts/elfun/acoth.m +++ b/scripts/elfun/acoth.m @@ -17,9 +17,9 @@ ### 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. +function w = acoth (z) if (nargin != 1) usage ("acoth (z)");
--- a/scripts/elfun/acsc.m +++ b/scripts/elfun/acsc.m @@ -17,10 +17,10 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## acsc (z): compute the inverse cosecant for each element of z. + function w = acsc (z) - ## acsc (z): compute the inverse cosecant for each element of z. - if (nargin != 1) usage ("acsc (z)"); endif
--- a/scripts/elfun/acsch.m +++ b/scripts/elfun/acsch.m @@ -17,10 +17,10 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## acsch (z): compute the inverse hyperbolic cosecant for each element of z. + function w = acsch (z) - ## acsch (z): compute the inverse hyperbolic cosecant for each element of z. - if (nargin != 1) usage ("acsch (z)"); endif
--- a/scripts/elfun/asec.m +++ b/scripts/elfun/asec.m @@ -17,10 +17,10 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## asec (z): compute the inverse secant for each element of z. + function w = asec (z) - ## asec (z): compute the inverse secant for each element of z. - if (nargin != 1) usage ("asec (z)"); endif
--- a/scripts/elfun/asech.m +++ b/scripts/elfun/asech.m @@ -17,10 +17,10 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## asech (z): compute the inverse hyperbolic secant for each element of z. + function w = asech (z) - ## asech (z): compute the inverse hyperbolic secant for each element of z. - if (nargin != 1) usage ("acosh (z)"); endif
--- a/scripts/elfun/cot.m +++ b/scripts/elfun/cot.m @@ -17,10 +17,10 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## cot (z): compute the cotangent for each element of z. + function w = cot (z) - ## cot (z): compute the cotangent for each element of z. - if (nargin != 1) usage ("cot (z)"); endif
--- a/scripts/elfun/coth.m +++ b/scripts/elfun/coth.m @@ -17,10 +17,10 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## coth (z): compute the hyperbolic cotangent for each element of z. + function w = coth (z) - ## coth (z): compute the hyperbolic cotangent for each element of z. - if (nargin != 1) usage ("coth (z)"); endif
--- a/scripts/elfun/csc.m +++ b/scripts/elfun/csc.m @@ -17,10 +17,10 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## csc (z): compute the cosecant for each element of z. + function w = csc (z) - ## csc (z): compute the cosecant for each element of z. - if (nargin != 1) usage ("csc (z)"); endif
--- a/scripts/elfun/csch.m +++ b/scripts/elfun/csch.m @@ -17,10 +17,10 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## csch (z): compute the hyperbolic cosecant for each element of z. + function w = csch (z) - ## csch (z): compute the hyperbolic cosecant for each element of z. - if (nargin != 1) usage ("csch (z)"); endif
--- a/scripts/elfun/gcd.m +++ b/scripts/elfun/gcd.m @@ -17,17 +17,17 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## 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]. + 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]. - - ## 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 @@ -17,15 +17,15 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## 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]). + 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]). - - ## 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 @@ -17,11 +17,11 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## log2 (z): compute the logarithm base 2 for each element of z. + function w = log2 (z) - ## log2 (z): compute the logarithm base 2 for each element of z. - - if (nargin != 1) +if (nargin != 1) usage ("log2 (z)"); endif
--- a/scripts/elfun/sec.m +++ b/scripts/elfun/sec.m @@ -17,10 +17,10 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## sec (z): compute the secant for each element of z. + function w = sec (z) - ## sec (z): compute the secant for each element of z. - if (nargin != 1) usage ("sec (z)"); endif
--- a/scripts/elfun/sech.m +++ b/scripts/elfun/sech.m @@ -17,11 +17,11 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## sech (z): compute the hyperbolic secant for each element of z. + function w = sech (z) - ## sech (z): compute the hyperbolic secant for each element of z. - - if (nargin != 1) +if (nargin != 1) usage ("sech (z)"); endif
--- a/scripts/general/columns.m +++ b/scripts/general/columns.m @@ -17,13 +17,13 @@ ### 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 +function nc = columns (x) if (nargin != 1) usage ("columns (x)");
--- a/scripts/general/fliplr.m +++ b/scripts/general/fliplr.m @@ -17,13 +17,13 @@ ### 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 +function y = fliplr (x) if (nargin != 1) usage ("fliplr (x)");
--- a/scripts/general/flipud.m +++ b/scripts/general/flipud.m @@ -17,13 +17,13 @@ ### 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 +function y = flipud (x) if (nargin != 1) usage ("flipud (x)");
--- a/scripts/general/int2str.m +++ b/scripts/general/int2str.m @@ -17,13 +17,13 @@ ### 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 +function retval = int2str (x) ## XXX FIXME XXX -- this will fail for very large values.
--- a/scripts/general/is_matrix.m +++ b/scripts/general/is_matrix.m @@ -17,14 +17,14 @@ ### 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 +function retval = is_matrix (x) if (nargin == 1) [nr, nc] = size (x);
--- a/scripts/general/is_scalar.m +++ b/scripts/general/is_scalar.m @@ -17,13 +17,13 @@ ### 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 +function retval = is_scalar (x) if (nargin == 1) [nr, nc] = size (x);
--- a/scripts/general/is_square.m +++ b/scripts/general/is_square.m @@ -17,14 +17,14 @@ ### 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 +function retval = is_square (x) ## Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993.
--- a/scripts/general/is_symmetric.m +++ b/scripts/general/is_symmetric.m @@ -17,14 +17,14 @@ ### 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 +function retval = is_symmetric (x,tol) ## Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993.
--- a/scripts/general/is_vector.m +++ b/scripts/general/is_vector.m @@ -17,14 +17,14 @@ ### 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 +function retval = is_vector (x) if (nargin == 1) [nr, nc] = size (x);
--- a/scripts/general/isempty.m +++ b/scripts/general/isempty.m @@ -17,11 +17,11 @@ ### 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. +function retval = isempty (var) if (nargin != 1) usage ("isempty (var)");
--- a/scripts/general/length.m +++ b/scripts/general/length.m @@ -17,13 +17,13 @@ ### 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 +function len = length (x) if (nargin != 1) usage ("length (x)");
--- a/scripts/general/logspace.m +++ b/scripts/general/logspace.m @@ -17,25 +17,25 @@ ### 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 +function retval = logspace (x1, x2, n) if (nargin == 2) npoints = 50;
--- a/scripts/general/nargchk.m +++ b/scripts/general/nargchk.m @@ -17,13 +17,13 @@ ### 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. +function retval = nargchk (nargin_min, nargin_max, n) if (nargin != 3) usage ("nargchk (nargin_min, nargin_max, n)");
--- a/scripts/general/num2str.m +++ b/scripts/general/num2str.m @@ -17,13 +17,13 @@ ### 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 +function retval = num2str (x) if (nargin == 1) if (rows (x) == 1 && columns (x) == 1)
--- a/scripts/general/perror.m +++ b/scripts/general/perror.m @@ -17,18 +17,18 @@ ### 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 +function perror (name, err) if (nargin != 2) usage ("perror (name, err)");
--- a/scripts/general/postpad.m +++ b/scripts/general/postpad.m @@ -17,15 +17,15 @@ ### 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. +function y = postpad (x, l, c) ## Author: ## Tony Richardson
--- a/scripts/general/prepad.m +++ b/scripts/general/prepad.m @@ -17,15 +17,15 @@ ### 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. +function y = prepad (x, l, c) ## Author: ## Tony Richardson
--- a/scripts/general/rem.m +++ b/scripts/general/rem.m @@ -17,11 +17,11 @@ ### 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). +function retval = rem (x, y) if (nargin != 2) usage ("rem (x, y)");
--- a/scripts/general/reshape.m +++ b/scripts/general/reshape.m @@ -17,14 +17,14 @@ ### 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 +function retval = reshape (a, m, n) if (nargin != 3) usage ("reshape (a, m, n)");
--- a/scripts/general/rot90.m +++ b/scripts/general/rot90.m @@ -17,15 +17,15 @@ ### 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 +function y = rot90 (x, k) if (nargin < 2) k = 1;
--- a/scripts/general/rows.m +++ b/scripts/general/rows.m @@ -17,13 +17,13 @@ ### 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 +function nr = rows (x) if (nargin != 1) usage ("rows (x)");
--- a/scripts/general/strerror.m +++ b/scripts/general/strerror.m @@ -17,17 +17,17 @@ ### 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 +function msg = strerror (name, err) if (nargin != 2) usage ("strerror (name, err)");
--- a/scripts/general/tril.m +++ b/scripts/general/tril.m @@ -17,14 +17,14 @@ ### 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 +function retval = tril (x, k) if (nargin > 0) [nr, nc] = size (x);
--- a/scripts/general/triu.m +++ b/scripts/general/triu.m @@ -17,14 +17,14 @@ ### 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 +function retval = triu (x, k) if (nargin > 0) [nr, nc] = size (x);
--- a/scripts/image/colormap.m +++ b/scripts/image/colormap.m @@ -17,19 +17,19 @@ ### 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. +function cmap = colormap (map) ## Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994.
--- a/scripts/image/gray.m +++ b/scripts/image/gray.m @@ -17,9 +17,9 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. -function map = gray (number) +## Colormap. - ## Colormap. +function map = gray (number) ## Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994.
--- a/scripts/image/gray2ind.m +++ b/scripts/image/gray2ind.m @@ -17,9 +17,9 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. -function [X, map] = gray2ind (I, n) +## Image format conversion - ## Image format conversion +function [X, map] = gray2ind (I, n) ## Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994.
--- a/scripts/image/image.m +++ b/scripts/image/image.m @@ -17,17 +17,17 @@ ### 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. +function image (x, zoom) ## Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994.
--- a/scripts/image/imagesc.m +++ b/scripts/image/imagesc.m @@ -17,17 +17,17 @@ ### 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 +function x = imagesc (x, zoom) ## Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994.
--- a/scripts/image/imshow.m +++ b/scripts/image/imshow.m @@ -17,19 +17,19 @@ ### 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. +function imshow (a1, a2, a3) ## Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994.
--- a/scripts/image/ind2gray.m +++ b/scripts/image/ind2gray.m @@ -17,18 +17,18 @@ ### 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 +function Y = ind2gray (X, map) ## Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994.
--- a/scripts/image/ind2rgb.m +++ b/scripts/image/ind2rgb.m @@ -17,15 +17,15 @@ ### 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. +function [R, G, B] = ind2rgb (X, map) ## Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994.
--- a/scripts/image/loadimage.m +++ b/scripts/image/loadimage.m @@ -17,15 +17,15 @@ ### 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 +function [X, map] = loadimage (filename) ## Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994.
--- a/scripts/image/ntsc2rgb.m +++ b/scripts/image/ntsc2rgb.m @@ -17,9 +17,9 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. -function rgb = ntsc2rgb (yiq) +## Image format conversion. - ## Image format conversion. +function rgb = ntsc2rgb (yiq) ## Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994.
--- a/scripts/image/ocean.m +++ b/scripts/image/ocean.m @@ -17,9 +17,9 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. -function map = ocean (number) +## Colormap. - ## Colormap. +function map = ocean (number) ## Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994.
--- a/scripts/image/rgb2ind.m +++ b/scripts/image/rgb2ind.m @@ -17,15 +17,15 @@ ### 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. +function [X, map] = rgb2ind (R, G, B) ## Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994.
--- a/scripts/image/rgb2ntsc.m +++ b/scripts/image/rgb2ntsc.m @@ -17,9 +17,9 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. -function yiq = rgb2ntsc (rgb) +## Image format conversion. - ## Image format conversion. +function yiq = rgb2ntsc (rgb) ## Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994.
--- a/scripts/image/saveimage.m +++ b/scripts/image/saveimage.m @@ -17,42 +17,42 @@ ### 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 +function saveimage (filename, img, img_form, map) ## Written by Tony Richardson (amr@mpl.ucsd.edu) July 1994.
--- a/scripts/io/printf.m +++ b/scripts/io/printf.m @@ -17,13 +17,13 @@ ### 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 +function retval = printf (fmt, ...) retval = -1;
--- a/scripts/io/puts.m +++ b/scripts/io/puts.m @@ -17,13 +17,13 @@ ### 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 +function retval = puts (s) retval = -1;
--- a/scripts/linear-algebra/cond.m +++ b/scripts/linear-algebra/cond.m @@ -17,14 +17,14 @@ ### 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 +function retval = cond (a) if (nargin == 1) [nr, nc] = size (a);
--- a/scripts/linear-algebra/kron.m +++ b/scripts/linear-algebra/kron.m @@ -17,14 +17,14 @@ ### 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] +function x = kron (a, b) ## Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993.
--- a/scripts/linear-algebra/norm.m +++ b/scripts/linear-algebra/norm.m @@ -17,33 +17,33 @@ ### 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 +function retval = norm (x, p) if (nargin < 1 || nargin > 2) error ("usage: norm (x [, p])");
--- a/scripts/linear-algebra/null.m +++ b/scripts/linear-algebra/null.m @@ -17,17 +17,17 @@ ### 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. +function retval = null (A, tol) ## Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Dec 24, 1993.
--- a/scripts/linear-algebra/orth.m +++ b/scripts/linear-algebra/orth.m @@ -17,17 +17,17 @@ ### 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. +function retval = orth (A, tol) ## Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Dec 24, 1993.
--- a/scripts/linear-algebra/qzhess.m +++ b/scripts/linear-algebra/qzhess.m @@ -17,20 +17,20 @@ ### 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. +function [aa, bb, q, z] = qzhess (a, b) ## Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993.
--- a/scripts/linear-algebra/rank.m +++ b/scripts/linear-algebra/rank.m @@ -17,19 +17,19 @@ ### 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. +function retval = rank (A, tol) if (nargin == 1) sigma = svd (A);
--- a/scripts/linear-algebra/trace.m +++ b/scripts/linear-algebra/trace.m @@ -17,11 +17,11 @@ ### 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. +function y = trace (x) if (nargin != 1) usage ("trace (x)");
--- a/scripts/miscellaneous/bug_report.m +++ b/scripts/miscellaneous/bug_report.m @@ -17,13 +17,13 @@ ### 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. +function bug_report () if (nargin != 0) warning ("bug_report: ignoring extra arguments");
--- a/scripts/miscellaneous/cputime.m +++ b/scripts/miscellaneous/cputime.m @@ -17,11 +17,11 @@ ### 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. +function [total, user, system] = cputime () if (nargin != 0) warning ("cputime: ignoring extra arguments");
--- a/scripts/miscellaneous/dump_prefs.m +++ b/scripts/miscellaneous/dump_prefs.m @@ -17,13 +17,13 @@ ### 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. +function dump_prefs (file) if (nargin == 0) file = stdout;
--- a/scripts/miscellaneous/etime.m +++ b/scripts/miscellaneous/etime.m @@ -17,14 +17,14 @@ ### 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 +function secs = etime (t1, t0) if (nargin != 2) usage ("etime (t1, t0)");
--- a/scripts/miscellaneous/flops.m +++ b/scripts/miscellaneous/flops.m @@ -17,11 +17,11 @@ ### 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. +function retval = flops () if (nargin > 0) usage ("flops ()");
--- a/scripts/miscellaneous/is_leap_year.m +++ b/scripts/miscellaneous/is_leap_year.m @@ -17,12 +17,12 @@ ### 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. +function retval = is_leap_year (year) if (nargin > 1) usage ("is_leap_year (year)");
--- a/scripts/miscellaneous/list_primes.m +++ b/scripts/miscellaneous/list_primes.m @@ -17,14 +17,14 @@ ### 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. +function retval = list_primes (n) if (nargin > 0) if (! is_scalar (n))
--- a/scripts/miscellaneous/menu.m +++ b/scripts/miscellaneous/menu.m @@ -17,11 +17,11 @@ ### 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 +function num = menu (t, ...) if (nargin < 2) usage ("menu (title, opt1, ...)");
--- a/scripts/miscellaneous/popen2.m +++ b/scripts/miscellaneous/popen2.m @@ -17,28 +17,28 @@ ### 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); +function [in, out, pid] = popen2 (command, args) in = -1; out = -1;
--- a/scripts/miscellaneous/texas_lotto.m +++ b/scripts/miscellaneous/texas_lotto.m @@ -17,14 +17,14 @@ ### 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 +function picks = texas_lotto () if (nargin != 0) warning ("win_texas_lotto: ignoring extra arguments");
--- a/scripts/miscellaneous/tic.m +++ b/scripts/miscellaneous/tic.m @@ -17,13 +17,13 @@ ### 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 +function tic () if (nargin != 0) warning ("tic: ignoring extra arguments");
--- a/scripts/miscellaneous/toc.m +++ b/scripts/miscellaneous/toc.m @@ -17,14 +17,14 @@ ### 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 +function secs = toc () if (nargin != 0) warning ("toc: ignoring extra arguments");
--- a/scripts/miscellaneous/version.m +++ b/scripts/miscellaneous/version.m @@ -17,13 +17,13 @@ ### 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 +function vs = version () if (nargin != 0) warning ("version: ignoring extra arguments");
--- a/scripts/plot/__pltopt__.m +++ b/scripts/plot/__pltopt__.m @@ -19,48 +19,48 @@ ## 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 +function fmt = plot_opt (caller, opt) set_color = 0; set_symbol = 0;
--- a/scripts/plot/axis.m +++ b/scripts/plot/axis.m @@ -17,19 +17,19 @@ ### 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. +function curr_axis = axis (ax) ## This may not be correct if someone has used the gnuplot interface ## directly...
--- a/scripts/plot/bar.m +++ b/scripts/plot/bar.m @@ -17,29 +17,29 @@ ### 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 +function [xb, yb] = bar (x, y) if (nargin == 1) if (is_vector (x))
--- a/scripts/plot/bottom_title.m +++ b/scripts/plot/bottom_title.m @@ -17,16 +17,16 @@ ### 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. - ## +function bottom_title (text) ## Written by Vinayak Dutt, Dutt.Vinayak@mayo.EDU
--- a/scripts/plot/contour.m +++ b/scripts/plot/contour.m @@ -17,12 +17,12 @@ ### 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 +function contour (z, n, x, y) if (nargin == 1)
--- a/scripts/plot/figure.m +++ b/scripts/plot/figure.m @@ -17,12 +17,12 @@ ### 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. +function figure (n) if (nargin == 1) if (gnuplot_has_frames)
--- a/scripts/plot/grid.m +++ b/scripts/plot/grid.m @@ -17,16 +17,16 @@ ### 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 +function grid (x) if (nargin == 0) set grid;
--- a/scripts/plot/hist.m +++ b/scripts/plot/hist.m @@ -17,28 +17,28 @@ ### 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 +function [nn, xx] = hist (y, x) if (nargin < 1 || nargin > 2) usage ("[nn, xx] = hist (y, x)");
--- a/scripts/plot/loglog.m +++ b/scripts/plot/loglog.m @@ -17,19 +17,19 @@ ### 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 +function loglog (...) set logscale x; set logscale y;
--- a/scripts/plot/mesh.m +++ b/scripts/plot/mesh.m @@ -17,18 +17,18 @@ ### 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 +function mesh (x, y, z) if (nargin == 1) z = x;
--- a/scripts/plot/meshdom.m +++ b/scripts/plot/meshdom.m @@ -17,17 +17,17 @@ ### 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 +function [xx, yy] = meshdom (x, y) if (nargin == 2) if (is_vector (x) && is_vector (y))
--- a/scripts/plot/meshgrid.m +++ b/scripts/plot/meshgrid.m @@ -17,18 +17,18 @@ ### 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 +function [xx, yy] = meshgrid (x, y) if (nargin == 1) y = x;
--- a/scripts/plot/mplot.m +++ b/scripts/plot/mplot.m @@ -17,20 +17,20 @@ ### 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. +function mplot (...) ## Written by Vinayak Dutt, Dutt.Vinayak@mayo.EDU
--- a/scripts/plot/multiplot.m +++ b/scripts/plot/multiplot.m @@ -17,18 +17,18 @@ ### 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 +function multiplot (xn, yn) ## Written by Vinayak Dutt, Dutt.Vinayak@mayo.EDU 3 Jul 95
--- a/scripts/plot/oneplot.m +++ b/scripts/plot/oneplot.m @@ -17,15 +17,15 @@ ### 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 +function oneplot () ## Written by Vinayak Dutt, Dutt.Vinayak@mayo.EDU 3 Jul 95
--- a/scripts/plot/plot.m +++ b/scripts/plot/plot.m @@ -17,51 +17,51 @@ ### 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 +function plot (...) set nologscale; set nopolar;
--- a/scripts/plot/plot_border.m +++ b/scripts/plot/plot_border.m @@ -17,26 +17,26 @@ ### 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. +function plot_border (...) ## Written by Vinayak Dutt, Dutt.Vinayak@mayo.EDU 3 Jul 95
--- a/scripts/plot/polar.m +++ b/scripts/plot/polar.m @@ -17,16 +17,16 @@ ### 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 +function polar (x1, x2, fmt) set nologscale; set nopolar;
--- a/scripts/plot/semilogx.m +++ b/scripts/plot/semilogx.m @@ -17,19 +17,19 @@ ### 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 +function semilogx (...) set logscale x; set nologscale y;
--- a/scripts/plot/semilogy.m +++ b/scripts/plot/semilogy.m @@ -17,19 +17,19 @@ ### 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 +function semilogy (...) set nologscale x; set logscale y;
--- a/scripts/plot/shg.m +++ b/scripts/plot/shg.m @@ -17,15 +17,15 @@ ### 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 +function shg () if (nargin != 0) warning ("shg: ignoring extra arguments");
--- a/scripts/plot/sombrero.m +++ b/scripts/plot/sombrero.m @@ -17,14 +17,14 @@ ### 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); +function sombrero (n) if (nargin != 1) usage ("sombrero (n)");
--- a/scripts/plot/stairs.m +++ b/scripts/plot/stairs.m @@ -17,29 +17,29 @@ ### 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 +function [xs, ys] = stairs (x, y) if (nargin == 1)
--- a/scripts/plot/subplot.m +++ b/scripts/plot/subplot.m @@ -17,43 +17,43 @@ ### 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 | - ## | | | | | - ## ----------------------------------- - ## +function subplot (rows, columns, index) ## Written by Vinayak Dutt, Dutt.Vinayak@mayo.EDU
--- a/scripts/plot/subwindow.m +++ b/scripts/plot/subwindow.m @@ -17,16 +17,16 @@ ### 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() +function subwindow (xn, yn) ## Written by Vinayak Dutt, Dutt.Vinayak@mayo.EDU 3 Jul 95
--- a/scripts/plot/title.m +++ b/scripts/plot/title.m @@ -17,15 +17,15 @@ ### 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 +function title (text) if (nargin != 1) usage ("title (text)");
--- a/scripts/plot/top_title.m +++ b/scripts/plot/top_title.m @@ -17,14 +17,14 @@ ### 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 +function top_title (text) ## Written by Vinayak Dutt, Dutt.Vinayak@mayo.EDU 3 Jul 95
--- a/scripts/plot/xlabel.m +++ b/scripts/plot/xlabel.m @@ -17,15 +17,15 @@ ### 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 +function xlabel (text) if (nargin != 1) usage ("xlabel (text)");
--- a/scripts/plot/ylabel.m +++ b/scripts/plot/ylabel.m @@ -17,15 +17,15 @@ ### 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 +function ylabel (text) if (nargin != 1) usage ("ylabel (text)");
--- a/scripts/plot/zlabel.m +++ b/scripts/plot/zlabel.m @@ -17,14 +17,14 @@ ### 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. +function zlabel (text) ## Written by Vinayak Dutt, Dutt.Vinayak@mayo.EDU 3 Jul 95
--- a/scripts/polynomial/compan.m +++ b/scripts/polynomial/compan.m @@ -17,32 +17,32 @@ ### 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 +function A = compan (c) ## Written by Tony Richardson (amr@mpl.ucsd.edu) June 1994.
--- a/scripts/polynomial/conv.m +++ b/scripts/polynomial/conv.m @@ -17,20 +17,20 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## 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 + 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 - ## Written by Tony Richardson (amr@mpl.ucsd.edu) June 1994. if (nargin != 2)
--- a/scripts/polynomial/deconv.m +++ b/scripts/polynomial/deconv.m @@ -17,21 +17,21 @@ ### 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 +function [b, r] = deconv (y, a) ## Written by Tony Richardson (amr@mpl.ucsd.edu) June 1994.
--- a/scripts/polynomial/poly.m +++ b/scripts/polynomial/poly.m @@ -17,16 +17,16 @@ ### 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. +function y = poly (x) ## Written by KH (Kurt.Hornik@neuro.tuwien.ac.at) Dec 24, 1993.
--- a/scripts/polynomial/polyder.m +++ b/scripts/polynomial/polyder.m @@ -17,11 +17,11 @@ ### 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 +function q = polyder (p) if (nargin == 1) q = polyderiv (p);
--- a/scripts/polynomial/polyderiv.m +++ b/scripts/polynomial/polyderiv.m @@ -17,15 +17,15 @@ ### 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 +function q = polyderiv (p) ## Written by Tony Richardson (amr@mpl.ucsd.edu) June 1994.
--- a/scripts/polynomial/polyfit.m +++ b/scripts/polynomial/polyfit.m @@ -17,14 +17,14 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## 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. + 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. - ## Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Dec 13, 1994 ## Copyright Dept of Statistics and Probability Theory TU Wien
--- a/scripts/polynomial/polyinteg.m +++ b/scripts/polynomial/polyinteg.m @@ -17,17 +17,17 @@ ### 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 +function p = polyinteg (p) ## Written by Tony Richardson (amr@mpl.ucsd.edu) June 1994.
--- a/scripts/polynomial/polyreduce.m +++ b/scripts/polynomial/polyreduce.m @@ -17,15 +17,15 @@ ### 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 +function p = polyreduce (p) ## Written by Tony Richardson (amr@mpl.ucsd.edu) June 1994.
--- a/scripts/polynomial/polyval.m +++ b/scripts/polynomial/polyval.m @@ -17,25 +17,25 @@ ### 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 +function y = polyval (c, x) ## Written by Tony Richardson (amr@mpl.ucsd.edu) June 1994.
--- a/scripts/polynomial/polyvalm.m +++ b/scripts/polynomial/polyvalm.m @@ -17,26 +17,26 @@ ### 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 +function y = polyvalm (c, x) ## Written by Tony Richardson (amr@mpl.ucsd.edu) June 1994.
--- a/scripts/polynomial/residue.m +++ b/scripts/polynomial/residue.m @@ -17,52 +17,52 @@ ### 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 +function [r, p, k, e] = residue (b, a, toler) ## Written by Tony Richardson (amr@mpl.ucsd.edu) June 1994.
--- a/scripts/polynomial/roots.m +++ b/scripts/polynomial/roots.m @@ -17,13 +17,13 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## 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). + 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). - ## Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Dec 24, 1993 ## Updated by KH on Nov 25, 1994
--- a/scripts/set/complement.m +++ b/scripts/set/complement.m @@ -17,13 +17,13 @@ ### 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 +function y = complement (a, b) if (nargin != 2) usage ("complement(a,b)");
--- a/scripts/set/create_set.m +++ b/scripts/set/create_set.m @@ -17,13 +17,13 @@ ### 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 +function y = create_set(x) if ( nargin != 1) usage ("create_set(x)");
--- a/scripts/set/intersection.m +++ b/scripts/set/intersection.m @@ -17,13 +17,13 @@ ### 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 +function y = intersection(a,b) if (nargin != 2) usage ("intersection(a,b)");
--- a/scripts/set/union.m +++ b/scripts/set/union.m @@ -17,13 +17,13 @@ ### 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 +function y = union(a,b) if (nargin != 2) usage ("union(a,b)");
--- a/scripts/signal/fftconv.m +++ b/scripts/signal/fftconv.m @@ -17,17 +17,17 @@ ### 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. +function c = fftconv (a, b, N) ## Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Sep 3, 1994.
--- a/scripts/signal/fftfilt.m +++ b/scripts/signal/fftfilt.m @@ -17,13 +17,13 @@ ### 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. +function y = fftfilt (b, x, N) ## Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Sep 3, 1994
--- a/scripts/signal/freqz.m +++ b/scripts/signal/freqz.m @@ -17,25 +17,25 @@ ### 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. +function [h, w] = freqz(b,...) if (nargin == 1) ## Response of an FIR filter.
--- a/scripts/signal/sinc.m +++ b/scripts/signal/sinc.m @@ -17,11 +17,11 @@ ### 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). +function result = sinc (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
--- a/scripts/specfun/beta.m +++ b/scripts/specfun/beta.m @@ -17,13 +17,13 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## usage: beta (a, b) +## +## Returns the beta function beta(a,b) = gamma(a) * gamma(b) / gamma(a+b) +## of a and b. + 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. - ## Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Jun 13, 1993 if (nargin != 2)
--- a/scripts/specfun/betai.m +++ b/scripts/specfun/betai.m @@ -17,15 +17,15 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## 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. + 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. - ## Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Aug 2, 1994. ## Computation is based on the series expansion
--- a/scripts/specfun/betainc.m +++ b/scripts/specfun/betainc.m @@ -17,12 +17,12 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## Usage: betainc (x, a, b) +## +## See also: betai + function y = betainc (x, a, b) - ## Usage: betainc (x, a, b) - ## - ## See also: betai - y = betai (a, b, x); endfunction
--- a/scripts/specfun/gammai.m +++ b/scripts/specfun/gammai.m @@ -17,21 +17,21 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## 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. + 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. - ## Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Aug 13, 1994 if (nargin != 2)
--- a/scripts/specfun/gammainc.m +++ b/scripts/specfun/gammainc.m @@ -17,12 +17,12 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## Usage: gammainc (x, a) +## +## See also: gammai + function y = gammainc (x, a) - ## Usage: gammainc (x, a) - ## - ## See also: gammai - y = gammai (a, x); endfunction
--- a/scripts/special-matrix/hadamard.m +++ b/scripts/special-matrix/hadamard.m @@ -17,13 +17,13 @@ ### 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 +function retval = hadamard (k) if (nargin != 1) usage ("hadamard (n)");
--- a/scripts/special-matrix/hankel.m +++ b/scripts/special-matrix/hankel.m @@ -17,18 +17,18 @@ ### 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 +function retval = hankel (c, r) if (nargin == 1) r = zeros (size (c));
--- a/scripts/special-matrix/hilb.m +++ b/scripts/special-matrix/hilb.m @@ -17,16 +17,16 @@ ### 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 +function retval = hilb (n) if (nargin != 1)
--- a/scripts/special-matrix/invhilb.m +++ b/scripts/special-matrix/invhilb.m @@ -17,14 +17,14 @@ ### 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 +function retval = invhilb (n) if (nargin != 1) usage ("invhilb (n)");
--- a/scripts/special-matrix/toeplitz.m +++ b/scripts/special-matrix/toeplitz.m @@ -17,18 +17,18 @@ ### 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 +function retval = toeplitz (c, r) if (nargin == 1) r = c;
--- a/scripts/special-matrix/vander.m +++ b/scripts/special-matrix/vander.m @@ -17,13 +17,13 @@ ### 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 +function retval = vander (c) if (nargin != 1) usage ("vander (c)");
--- a/scripts/statistics/corrcoef.m +++ b/scripts/statistics/corrcoef.m @@ -17,14 +17,14 @@ ### 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). +function retval = corrcoef (X, Y) ## Written by Kurt Hornik (hornik@ci.tuwien.ac.at) March 1993. ## Dept of Probability Theory and Statistics TU Wien, Austria.
--- a/scripts/statistics/cov.m +++ b/scripts/statistics/cov.m @@ -17,14 +17,14 @@ ### 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). +function retval = cov (X, Y) ## Written by Kurt Hornik (hornik@ci.tuwien.ac.at) March 1993. ## Dept of Probability Theory and Statistics TU Wien, Austria.
--- a/scripts/statistics/gls.m +++ b/scripts/statistics/gls.m @@ -17,24 +17,24 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## 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. + 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. - ## Written by Teresa Twaroch (twaroch@ci.tuwien.ac.at) May 1993. ## Dept of Probability Theory and Statistics TU Wien, Austria.
--- a/scripts/statistics/kurtosis.m +++ b/scripts/statistics/kurtosis.m @@ -17,18 +17,18 @@ ### 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. +function retval = kurtosis (x) ## Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Jul 29, 1994.
--- a/scripts/statistics/mahalanobis.m +++ b/scripts/statistics/mahalanobis.m @@ -17,13 +17,13 @@ ### 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). +function retval = mahalanobis (X, Y) ## Written by Friedrich Leisch (leisch@ci.tuwien.ac.at) July 1993. ## Dept of Probability Theory and Statistics TU Wien, Austria.
--- a/scripts/statistics/mean.m +++ b/scripts/statistics/mean.m @@ -17,16 +17,16 @@ ### 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 +function retval = mean (a) if (nargin != 1) usage ("mean (a)");
--- a/scripts/statistics/median.m +++ b/scripts/statistics/median.m @@ -17,16 +17,16 @@ ### 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 +function retval = median (a) if (nargin != 1) usage ("median (a)");
--- a/scripts/statistics/ols.m +++ b/scripts/statistics/ols.m @@ -17,29 +17,29 @@ ### 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. +function [BETA, SIGMA, R] = ols (Y, X) ## Written by Teresa Twaroch (twaroch@ci.tuwien.ac.at) May 1993. ## Dept of Probability Theory and Statistics TU Wien, Austria.
--- a/scripts/statistics/skewness.m +++ b/scripts/statistics/skewness.m @@ -17,18 +17,18 @@ ### 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. +function retval = skewness (x) ## Written by KH (Kurt.Hornik@ci.tuwien.ac.at) on Jul 29, 1994.
--- a/scripts/statistics/std.m +++ b/scripts/statistics/std.m @@ -17,15 +17,15 @@ ### 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 +function retval = std (a) if (nargin != 1) usage ("std (a)");
--- a/scripts/strings/bin2dec.m +++ b/scripts/strings/bin2dec.m @@ -17,14 +17,14 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## usage: bin2dec (x) +## +## Returns the decimal number corresponding to the binary number in +## quotes. For example, bin2dec ("1110") returns 14. + function y = bin2dec (x) - ## 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 @@ -17,13 +17,13 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## usage: blanks (n) +## +## Returns a string of n blanks. + function s = blanks (n) - ## 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 @@ -17,13 +17,13 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## usage: deblank (s) +## +## Remove trailing blanks from the string s. + function t = deblank (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 @@ -17,12 +17,12 @@ ### 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". +function y = dec2bin (x) ## Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>.
--- a/scripts/strings/dec2hex.m +++ b/scripts/strings/dec2hex.m @@ -17,14 +17,14 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## usage: dec2hex (d) +## +## Returns the hex number corresponding to the decimal number d. For +## example, dec2hex (2748) returns "abc". + function h = dec2hex (d) - ## 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 @@ -17,20 +17,20 @@ ### 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] +function v = findstr (s, t, overlap) ## Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>.
--- a/scripts/strings/hex2dec.m +++ b/scripts/strings/hex2dec.m @@ -17,13 +17,13 @@ ### 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. +function d = hex2dec (h) ## Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>.
--- a/scripts/strings/index.m +++ b/scripts/strings/index.m @@ -17,14 +17,14 @@ ### 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. +function n = index (s, t) ## This is patterned after the AWK function of the same name.
--- a/scripts/strings/rindex.m +++ b/scripts/strings/rindex.m @@ -17,14 +17,14 @@ ### 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. +function n = rindex (s, t) ## This is patterned after the AWK function of the same name.
--- a/scripts/strings/split.m +++ b/scripts/strings/split.m @@ -17,15 +17,15 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## 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). + 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). - - ## 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 @@ -17,13 +17,13 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## 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. + 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. - ## Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>. if (nargin == 0)
--- a/scripts/strings/strcmp.m +++ b/scripts/strings/strcmp.m @@ -17,19 +17,19 @@ ### 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. +function status = strcmp (s1, s2) if (nargin != 2) usage ("strcmp (s, t)");
--- a/scripts/strings/strrep.m +++ b/scripts/strings/strrep.m @@ -17,14 +17,14 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. +## usage: strrep (s, x, y) +## +## Replace all occurences of the substring x of the string s with the +## string y. + 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. - - ## Written by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at> on 1994/10/11 +## 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)
--- a/scripts/strings/substr.m +++ b/scripts/strings/substr.m @@ -17,12 +17,12 @@ ### 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. +function t = substr (s, beg, len) ## Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>.
--- a/scripts/time/asctime.m +++ b/scripts/time/asctime.m @@ -17,9 +17,9 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. -function retval = asctime (t) +## usage: asctime (TMSTRUCT) - ## usage: asctime (TMSTRUCT) +function retval = asctime (t) if (nargin == 1) retval = strftime ("%a %b %d %H:%M:%S %Y\n", t);
--- a/scripts/time/clock.m +++ b/scripts/time/clock.m @@ -17,13 +17,13 @@ ### 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 ] +function retval = clock () tm = localtime (time ());
--- a/scripts/time/ctime.m +++ b/scripts/time/ctime.m @@ -17,9 +17,9 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. -function retval = ctime (t) +## usage: ctime (TIME) - ## usage: ctime (TIME) +function retval = ctime (t) if (nargin == 1) retval = asctime (localtime (t));
--- a/scripts/time/date.m +++ b/scripts/time/date.m @@ -17,11 +17,11 @@ ### 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'. +function retval = date () retval = strftime ("%d-%b-%y", localtime (time ()));