home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-bin / info / octave.info-5 < prev    next >
Encoding:
GNU Info File  |  1996-10-12  |  44.7 KB  |  1,375 lines

  1. This is Info file octave.info, produced by Makeinfo-1.64 from the input
  2. file octave.texi.
  3.  
  4.    Copyright (C) 1993, 1994, 1995 John W. Eaton.
  5.  
  6.    Permission is granted to make and distribute verbatim copies of this
  7. manual provided the copyright notice and this permission notice are
  8. preserved on all copies.
  9.  
  10.    Permission is granted to copy and distribute modified versions of
  11. this manual under the conditions for verbatim copying, provided that
  12. the entire resulting derived work is distributed under the terms of a
  13. permission notice identical to this one.
  14.  
  15.    Permission is granted to copy and distribute translations of this
  16. manual into another language, under the above conditions for modified
  17. versions.
  18.  
  19. 
  20. File: octave.info,  Node: Ordinary Differential Equations,  Next: Differential-Algebraic Equations,  Prev: Differential Equations,  Up: Differential Equations
  21.  
  22. Ordinary Differential Equations
  23. ===============================
  24.  
  25.    The function `lsode' can be used Solve ODEs of the form
  26.  
  27.      dx
  28.      -- = f (x, t)
  29.      dt
  30.  
  31. using Hindmarsh's ODE solver LSODE.
  32.  
  33.      lsode (FCN, X0, T_OUT, T_CRIT)
  34.  
  35.    The first argument is the name of the function to call to compute
  36. the vector of right hand sides.  It must have the form
  37.  
  38.      XDOT = f (X, T)
  39.  
  40. where XDOT and X are vectors and T is a scalar.
  41.  
  42.    The second argument specifies the initial condition, and the third
  43. specifies a vector of output times at which the solution is desired,
  44. including the time corresponding to the initial condition.
  45.  
  46.    The fourth argument is optional, and may be used to specify a set of
  47. times that the ODE solver should not integrate past.  It is useful for
  48. avoiding difficulties with singularities and points where there is a
  49. discontinuity in the derivative.
  50.  
  51.    Tolerances and other options for `lsode' may be specified using the
  52. function `lsode_options'.
  53.  
  54.    Here is an example of solving a set of two differential equations
  55. using `lsode'.  The function
  56.  
  57.      function xdot = f (x, t)
  58.      
  59.        r = 0.25;
  60.        k = 1.4;
  61.        a = 1.5;
  62.        b = 0.16;
  63.        c = 0.9;
  64.        d = 0.8;
  65.      
  66.        xdot(1) = r*x(1)*(1 - x(1)/k) - a*x(1)*x(2)/(1 + b*x(1));
  67.        xdot(2) = c*a*x(1)*x(2)/(1 + b*x(1)) - d*x(2);
  68.      
  69.      endfunction
  70.  
  71. is integrated with the command
  72.  
  73.      x = lsode ("f", [1; 2], (t = linspace (0, 50, 200)'));
  74.  
  75. producing a set of 200 values stored in the variable X.  Note that this
  76. example takes advantage of the fact that an assignment produces a value
  77. to store the values of the output times in the variable T directly in
  78. the function call   The results can then be plotted using the command
  79.  
  80.      plot (t, x)
  81.  
  82.    See Alan C. Hindmarsh, `ODEPACK, A Systematized Collection of ODE
  83. Solvers', in Scientific Computing, R. S. Stepleman, editor, (1983) for
  84. more information about this family of ODE solvers.
  85.  
  86. 
  87. File: octave.info,  Node: Differential-Algebraic Equations,  Prev: Ordinary Differential Equations,  Up: Differential Equations
  88.  
  89. Differential-Algebraic Equations
  90. ================================
  91.  
  92.    The function `dassl' can be used Solve DAEs of the form
  93.  
  94.      0 = f (x-dot, x, t),    x(t=0) = x_0, x-dot(t=0) = x-dot_0
  95.  
  96.      dassl (FCN, X_0, XDOT_0, T_OUT, T_CRIT)
  97.  
  98.    The first argument is the name of the function to call to compute
  99. the vector of residuals.  It must have the form
  100.  
  101.      RES = f (X, XDOT, T)
  102.  
  103. where X, XDOT, and RES are vectors, and T is a scalar.
  104.  
  105.    The second and third arguments to `dassl' specify the initial
  106. condition of the states and their derivatives, and the fourth argument
  107. specifies a vector of output times at which the solution is desired,
  108. including the time corresponding to the initial condition.
  109.  
  110.    The set of initial states and derivatives are not strictly required
  111. to be consistent.  In practice, however, DASSL is not very good at
  112. determining a consistent set for you, so it is best if you ensure that
  113. the initial values result in the function evaluating to zero.
  114.  
  115.    The fifth argument is optional, and may be used to specify a set of
  116. times that the DAE solver should not integrate past.  It is useful for
  117. avoiding difficulties with singularities and points where there is a
  118. discontinuity in the derivative.
  119.  
  120.    Tolerances and other options for `dassl' may be specified using the
  121. function `dassl_options'.
  122.  
  123.    See K. E. Brenan, et al., `Numerical Solution of Initial-Value
  124. Problems in Differential-Algebraic Equations', North-Holland (1989) for
  125. more information about the implementation of DASSL.
  126.  
  127. 
  128. File: octave.info,  Node: Optimization,  Next: Quadrature,  Prev: Differential Equations,  Up: Top
  129.  
  130. Optimization
  131. ************
  132.  
  133. * Menu:
  134.  
  135. * Quadratic Programming::
  136. * Nonlinear Programming::
  137. * Linear Least Squares::
  138.  
  139. 
  140. File: octave.info,  Node: Quadratic Programming,  Next: Nonlinear Programming,  Prev: Optimization,  Up: Optimization
  141.  
  142. Quadratic Programming
  143. =====================
  144.  
  145. `qpsol'
  146.           [x, obj, info, lambda]
  147.              = qpsol (x, H, c, lb, ub, lb, A, ub)
  148.      Solve quadratic programs using Gill and Murray's QPSOL.  Because
  149.      QPSOL is not freely redistributable, this function is only
  150.      available if you have obtained your own copy of QPSOL.  *Note
  151.      Installation::.
  152.  
  153.    Tolerances and other options for `qpsol' may be specified using the
  154. function `qpsol_options'.
  155.  
  156. 
  157. File: octave.info,  Node: Nonlinear Programming,  Next: Linear Least Squares,  Prev: Quadratic Programming,  Up: Optimization
  158.  
  159. Nonlinear Programming
  160. =====================
  161.  
  162. `npsol'
  163.           [x, obj, info, lambda]
  164.              = npsol (x, 'phi', lb, ub, lb, A, ub, lb, 'g', ub)
  165.      Solve nonlinear programs using Gill and Murray's NPSOL.  Because
  166.      NPSOL is not freely redistributable, this function is only
  167.      available if you have obtained your own copy of NPSOL.  *Note
  168.      Installation::.
  169.  
  170.      The second argument is a string containing the name of the
  171.      objective function to call.  The objective function must be of the
  172.      form
  173.  
  174.           y = phi (x)
  175.  
  176.      where x is a vector and y is a scalar.
  177.  
  178.    Tolerances and other options for `npsol' may be specified using the
  179. function `npsol_options'.
  180.  
  181. 
  182. File: octave.info,  Node: Linear Least Squares,  Prev: Nonlinear Programming,  Up: Optimization
  183.  
  184. Linear Least Squares
  185. ====================
  186.  
  187. `gls (Y, X, O)'
  188.      Generalized least squares (GLS) estimation for the multivariate
  189.      model
  190.  
  191.           Y = X * B + E,  mean(E) = 0,  cov(vec(E)) = (s^2)*O
  192.  
  193.      with
  194.  
  195.           Y an T x p matrix
  196.           X an T x k matrix
  197.           B an k x p matrix
  198.           E an T x p matrix
  199.           O an Tp x Tp matrix
  200.  
  201.      Each row of Y and X is an observation and each column a variable.
  202.  
  203.      Returns BETA, v, and, R, where BETA is the GLS estimator for B, v
  204.      is the GLS estimator for s^2, and R = Y - X*BETA is the matrix of
  205.      GLS residuals.
  206.  
  207. `ols (Y, X)'
  208.      Ordinary Least Squares (OLS) estimation for the multivariate model
  209.  
  210.           Y = X*B + E,  mean (E) = 0,  cov (vec (E)) = kron (S, I)
  211.  
  212.      with
  213.  
  214.           Y an T x p matrix
  215.           X an T x k matrix
  216.           B an k x p matrix
  217.           E an T x p matrix
  218.  
  219.      Each row of Y and X is an observation and each column a variable.
  220.  
  221.      Returns BETA, SIGMA, and R, where BETA is the OLS estimator for B,
  222.      i.e.
  223.  
  224.           BETA = pinv(X)*Y,
  225.  
  226.      where pinv(X) denotes the pseudoinverse of X, SIGMA is the OLS
  227.      estimator for the matrix S, i.e.
  228.  
  229.           SIGMA = (Y - X*BETA)'*(Y - X*BETA) / (T - rank(X))
  230.  
  231.      and R = Y - X*BETA is the matrix of OLS residuals.
  232.  
  233. 
  234. File: octave.info,  Node: Quadrature,  Next: Control Theory,  Prev: Optimization,  Up: Top
  235.  
  236. Quadrature
  237. **********
  238.  
  239. * Menu:
  240.  
  241. * Functions of one Variable::
  242. * Orthogonal Collocation::
  243.  
  244. 
  245. File: octave.info,  Node: Functions of one Variable,  Next: Orthogonal Collocation,  Prev: Quadrature,  Up: Quadrature
  246.  
  247. Functions of one Variable
  248. =========================
  249.  
  250. `quad'
  251.           [v, ier, nfun] = quad ("f", a, b)
  252.           [v, ier, nfun] = quad ("f", a, b, tol)
  253.           [v, ier, nfun] = quad ("f", a, b, tol, sing)
  254.  
  255.      Integrate a nonlinear function of one variable using Quadpack.
  256.  
  257.      Where the first argument is the name of the  function to call to
  258.      compute the value of the integrand.  It must have the form
  259.  
  260.           y = f (x)
  261.  
  262.      where y and x are scalars.
  263.  
  264.      The second and third arguments are limits of integration.  Either
  265.      or both may be infinite.  The optional argument tol specifies the
  266.      desired accuracy of the result.  The optional argument SING is a
  267.      vector of values at which the integrand is singular.
  268.  
  269.      Tolerances and other options for `quad' may be specified using the
  270.      function `quad_options'.
  271.  
  272. 
  273. File: octave.info,  Node: Orthogonal Collocation,  Prev: Functions of one Variable,  Up: Quadrature
  274.  
  275. Orthogonal Collocation
  276. ======================
  277.  
  278. `colloc'
  279.           [r, A, B, q] = colloc (n)
  280.           [r, A, B, q] = colloc (n, "left")
  281.           [r, A, B, q] = colloc (n, "left", "right")
  282.  
  283.      Compute derivative and integral weight matrices for orthogonal
  284.      collocation using the subroutines given in J. Michelsen and M. L.
  285.      Villadsen, `Solution of Differential Equation Models by Polynomial
  286.      Approximation'.
  287.  
  288. 
  289. File: octave.info,  Node: Control Theory,  Next: Signal Processing,  Prev: Quadrature,  Up: Top
  290.  
  291. Control Theory
  292. **************
  293.  
  294. `abcddim (A, B, C, D)'
  295.      Check for compatibility of the dimensions of the matrices defining
  296.      the linear system [A, B, C, D] corresponding to
  297.  
  298.           dx/dt = a x + b u
  299.           y = c x + d u
  300.  
  301.      or a similar discrete-time system.
  302.  
  303.      If the matrices are compatibly dimensioned, then `abcddim' returns
  304.      N = number of system states, M = number of system inputs, and P =
  305.      number of system outputs.  Otherwise `abcddim' returns N = M = P =
  306.      -1.
  307.  
  308. `are (A, B, C, OPT)'
  309.      Returns the solution, X, of the algebraic Riccati equation
  310.  
  311.           a' x + x a - x b x + c = 0
  312.  
  313.      for identically dimensioned square matrices A, B, C.  If B (C) is
  314.      not square, then the function attempts to use `B*B'' (`C'*C')
  315.      instead.
  316.  
  317.      Solution method: apply Laub's Schur method (IEEE Transactions on
  318.      Automatic Control, 1979) to the appropriate Hamiltonian matrix.
  319.  
  320.      OPT is an option passed to the eigenvalue balancing routine.
  321.      Default is `"B"'.
  322.  
  323. `c2d (A, B, T)'
  324.      Converts the continuous time system described by:
  325.  
  326.           dx/dt = a x + b u
  327.  
  328.      into a discrete time equivalent model
  329.  
  330.           x[k+1] = Ad x[k] + Bd u[k]
  331.  
  332.      via the matrix exponential assuming a zero-order hold on the input
  333.      and sample time T.
  334.  
  335. `dare (A, B, C, R, OPT)'
  336.      Returns the solution, X of the discrete-time algebraic Riccati
  337.      equation
  338.  
  339.           a' x a - x + a' x b (r + b' x b)^(-1) b' x a + c = 0
  340.  
  341.      for matrices with dimensions:
  342.  
  343.           A: N by N
  344.           B: N by M
  345.           C: N by N, symmetric positive semidefinite
  346.           R: M by M, symmetric positive definite (invertible)
  347.  
  348.      If C is not square, then the function attempts to use `C'*C'
  349.      instead.
  350.  
  351.      Solution method: Laub's Schur method (IEEE Transactions on
  352.      Automatic Control, 1979) is applied to the appropriate symplectic
  353.      matrix.
  354.  
  355.      See also: Ran and Rodman, `Stable Hermitian Solutions of Discrete
  356.      Algebraic Riccati Equations', Mathematics of Control, Signals and
  357.      Systems, Volume 5, Number 2 (1992).
  358.  
  359.      OPT is an option passed to the eigenvalue balancing routine.  The
  360.      default is `"B"'.
  361.  
  362. `dgram (A, B)'
  363.      Returns the discrete controllability and observability gramian for
  364.      the discrete time system described by
  365.  
  366.           x[k+1] = A x[k] + B u[k]
  367.             y[k] = C x[k] + D u[k]
  368.  
  369.      `dgram (A, B)' returns the discrete controllability gramian and
  370.      `dgram (A', C')' returns the observability gramian.
  371.  
  372. `dlqe (A, G, C, SIGW, SIGV [, Z])'
  373.      Linear quadratic estimator (Kalman filter) design for the discrete
  374.      time system
  375.  
  376.           x[k+1] = A x[k] + B u[k] + G w[k]
  377.             y[k] = C x[k] + D u[k] + w[k]
  378.  
  379.      where W, V are zero-mean gaussian noise processes with respective
  380.      intensities `SIGW = cov (W, W)' and `SIGV = cov (V, V)'.
  381.  
  382.      If specified, Z is `cov (W, V)'.  Otherwise `cov (W, V) = 0'.
  383.  
  384.      The observer structure is
  385.  
  386.           z[k+1] = A z[k] + B u[k] + k(y[k] - C z[k] - D u[k])
  387.  
  388.      Returns:
  389.  
  390.      L is the observer gain, `(A - A L C)' is stable.
  391.  
  392.      M is the Ricatti equation solution.
  393.  
  394.      P is the estimate error covariance after the measurement update.
  395.  
  396.      E are the closed loop poles of `(A - A L C)'.
  397.  
  398. `dlqr (A, B, Q, R [, Z])'
  399.      Linear quadratic regulator design for the discrete time system
  400.  
  401.           x[k+1] = A x[k] + B u[k]
  402.  
  403.      to minimize the cost functional
  404.  
  405.           J = Sum [ x' Q x + u' R u ],              Z omitted
  406.  
  407.      or
  408.  
  409.           J = Sum [ x' Q x + u' R u +2 x' Z u ],    Z included
  410.  
  411.      Returns:
  412.  
  413.      K is the state feedback gain, `(A - B K)' is stable.
  414.  
  415.      P is the solution of algebraic Riccati equation.
  416.  
  417.      E are the closed loop poles of (A - B K).
  418.  
  419. `dlyap (A, B)'
  420.      Solve the discrete-time Lyapunov equation
  421.  
  422.           a x a' - x + b = 0
  423.  
  424.      for square matrices A, B.  If B is not square, then the function
  425.      attempts to solve either
  426.  
  427.           a x a' - x + b b' = 0
  428.  
  429.      or
  430.  
  431.           a' x a - x + b' b = 0
  432.  
  433.      whichever is appropriate.
  434.  
  435.      Uses Schur decomposition method as in Kitagawa, International
  436.      Journal of Control (1977); column-by-column solution method as
  437.      suggested in Hammarling, IMA Journal of Numerical Analysis, (1982).
  438.  
  439. `is_controllable (A, B, TOL)'
  440.      If the pair (a, b) is controllable, then return value 1.
  441.      Otherwise, returns a value of 0.
  442.  
  443.      TOL is a roundoff parameter, set to `2*eps' if omitted.
  444.  
  445.      Currently just constructs the controllability matrix and checks
  446.      rank.  A better method is as follows (Boley and Golub, Systems and
  447.      Control Letters, 1984):  Controllability is determined by applying
  448.      Arnoldi iteration with complete re-orthogonalization to obtain an
  449.      orthogonal basis of the Krylov subspace
  450.  
  451.                                 n-1
  452.            span ([b, a*b, ..., a^   *b]).
  453.  
  454. `is_observable (A, C, TOL)'
  455.      Returns 1 if the pair `(a, c)' is observable.  Otherwise, returns
  456.      a value of 0.
  457.  
  458. `lqe (A, G, C, SIGW, SIGV, Z)'
  459.           [k, p, e] = lqe (a, g, c, sigw, sigv, z)
  460.  
  461.      Linear quadratic estimator (Kalman filter) design for the
  462.      continuous time system
  463.  
  464.           dx
  465.           -- = a x + b u
  466.           dt
  467.           
  468.           y = c x + d u
  469.  
  470.      where W, V are zero-mean gaussian noise processes with respective
  471.      intensities
  472.  
  473.           sigw = cov (w, w)
  474.           sigv = cov (v, v)
  475.  
  476.      Z (if specified) is the cross-covariance `cov (W, V)'; the default
  477.      value is `cov (W, V) = 0'.
  478.  
  479.      Observer structure is `dz/dt = A z + B u + k (y - C z - D u)'
  480.  
  481.      returns:
  482.  
  483.      K is observer gain:  `(A - K C)' is stable.
  484.  
  485.      P is solution of algebraic Riccati equation.
  486.  
  487.      E is the vector of closed loop poles of `(A - K C)'.
  488.  
  489. `lqr (A, B, Q, R, Z)'
  490. `[K, P, E] = lqr (A, B, Q, R, Z)'
  491.      Linear quadratic regulator design for the continuous time system
  492.  
  493.           dx
  494.           -- = A x + B u
  495.           dt
  496.  
  497.      to minimize the cost functional
  498.  
  499.                 infinity
  500.                 /
  501.             J = |  x' Q x + u' R u
  502.                /
  503.               t=0
  504.  
  505.      Z omitted or
  506.  
  507.                 infinity
  508.                 /
  509.             J = |  x' Q x + u' R u + 2 x' Z u
  510.                /
  511.               t=0
  512.  
  513.      Z included
  514.  
  515.      Returns:
  516.  
  517.      K is state feedback gain:  `(A - B K)' is stable.
  518.  
  519.      P is the stabilizing solution of appropriate algebraic Riccati
  520.      equation.
  521.  
  522.      E is the vector of the closed loop poles of `(A - B K)'.
  523.  
  524. `lyap (A, B, C)'
  525.      Solve the Lyapunov (or Sylvester) equation via the Bartels-Stewart
  526.      algorithm (Communications of the ACM, 1972).
  527.  
  528.      If `(a, b, c)' are specified, then `lyap' returns the solution of
  529.      the  Sylvester equation
  530.  
  531.           a x + x b + c = 0
  532.  
  533.      If only `(a, b)' are specified, then `lyap' returns the solution
  534.      of the Lyapunov equation
  535.  
  536.           a' x + x a + b = 0
  537.  
  538.      If B is not square, then `lyap' returns the solution of either
  539.  
  540.           a' x + x a + b' b = 0
  541.  
  542.      or
  543.  
  544.           a x + x a' + b b' = 0
  545.  
  546.      whichever is appropriate.
  547.  
  548.      Solves by using the Bartels-Stewart algorithm (1972).
  549.  
  550. `tzero (A, B, C, D, BAL)'
  551.      Compute the transmission zeros of [A, B, C, D].
  552.  
  553.      BAL = balancing option (see balance); default is `"B"'.
  554.  
  555.      Needs to incorporate `mvzero' algorithm to isolate finite zeros;
  556.      see Hodel, `Computation of System Zeros with Balancing', Linear
  557.      Algebra and its Applications, July 1993.
  558.  
  559. 
  560. File: octave.info,  Node: Signal Processing,  Next: Sets,  Prev: Control Theory,  Up: Top
  561.  
  562. Signal Processing
  563. *****************
  564.  
  565.    I hope that someday Octave will include more signal processing
  566. functions.  If you would like to help improve Octave in this area,
  567. please contact `bug-octave@che.utexas.edu'.
  568.  
  569. `fft (A)'
  570.      Compute the FFT of A using subroutines from FFTPACK.
  571.  
  572. `fft2 (A)'
  573.      Compute the two dimensional FFT of A.
  574.  
  575. `fftconv (A, B, N)'
  576.      This function returns the convolution of the vectors A and B, a
  577.      vector with length equal to the `length (a) + length (b) - 1'.  If
  578.      A and B are the coefficient vectors of two polynomials, the
  579.      returned value is the coefficient vector of the product polynomial.
  580.  
  581.      The computation uses the FFT by calling the function `fftfilt'.  If
  582.      the optional argument N is specified, an N-point FFT is used.
  583.  
  584. `fftfilt (B, X, N)'
  585.      With two arguments, `fftfilt' filters X with the FIR filter B
  586.      using the FFT.
  587.  
  588.      Given the optional third argument, N, `fftfilt' uses the
  589.      overlap-add method to filter X with B using an N-point FFT.
  590.  
  591. `filter (B, A, X)'
  592.      This function returns the solution to the following linear,
  593.      time-invariant difference equation:
  594.  
  595.              N                   M
  596.             SUM a(k+1) y(n-k) + SUM b(k+1) x(n-k) = 0  for 1<=n<=length(x)
  597.             k=0                 k=0
  598.  
  599.      where  N=length(a)-1 and M=length(b)-1.  An equivalent form of
  600.      this equation is:
  601.  
  602.                     N                   M
  603.             y(n) = SUM c(k+1) y(n-k) + SUM d(k+1) x(n-k)  for 1<=n<=length(x)
  604.                    k=1                 k=0
  605.  
  606.      where  c = a/a(1) and d = b/a(1).
  607.  
  608.      In terms of the z-transform, y is the result of passing the
  609.      discrete- time signal x through a system characterized by the
  610.      following rational system function:
  611.  
  612.                        M
  613.                       SUM d(k+1) z^(-k)
  614.                       k=0
  615.             H(z) = ----------------------
  616.                          N
  617.                     1 + SUM c(k+1) z(-k)
  618.                         k=1
  619.  
  620.      When called as
  621.  
  622.           [y, sf] = filter (b, a, x, si)
  623.  
  624.      `filter' uses the argument SI as the initial state of the system
  625.      and and returns the final state in SF.  The state vector is a
  626.      column vector whose length is equal to the length of the longest
  627.      coefficient vector minus one.  If SI is not set, the initial state
  628.      vector is set to all zeros.
  629.  
  630. `freqz'
  631.      Compute the frequency response of a filter.
  632.  
  633.      `[H, W] = freqz (B)' returns the complex frequency response H of
  634.      the FIR filter with coefficients B. The response is evaluated at
  635.      512 angular frequencies between 0 and  pi.
  636.  
  637.      The output value W is a vector containing the 512 frequencies.
  638.  
  639.      `[H, W] = freqz (B, A)' returns the complex frequency response of
  640.      the rational IIR filter whose numerator has coefficients B and
  641.      denominator coefficients A.
  642.  
  643.      `[H, W] = freqz (B, A, N)' returns the response evaluated at N
  644.      angular frequencies.  For fastest computation n should factor into
  645.      a small number of small primes.
  646.  
  647.      `[H, W] = freqz (B, A, N, "whole")' evaluates the response at n
  648.      frequencies between 0 and  2*pi.
  649.  
  650. `ifft (A)'
  651.      Compute the inverse FFT of A using subroutines from FFTPACK.
  652.  
  653. `ifft2'
  654.      Compute the two dimensional inverse FFT of A.
  655.  
  656. `sinc (X)'
  657.      Returns  sin(pi*x)/(pi*x).
  658.  
  659. 
  660. File: octave.info,  Node: Sets,  Next: Statistics,  Prev: Signal Processing,  Up: Top
  661.  
  662. Sets
  663. ****
  664.  
  665.    Octave has a limited set of functions for managing sets of data,
  666. where a set is defined as a collection unique elements.
  667.  
  668.    Given a matrix or vector of values, the function `create_set'
  669. returns a row vector containing unique values, sorted in ascending
  670. order.  For example, `create_set ([1, 2; 3, 4; 4, 2])' returns the
  671. vector `[1, 2, 3, 4]'.
  672.  
  673.    The functions `union' and `intersection' take two sets as arguments
  674. and return the union and interection, respectively.  For example,
  675. `union ([1, 2, 3], [2, 3, 5])' returns the vector `[1, 2, 5]'.
  676.  
  677.    The function `complement (A, B)' returns the elements of set B that
  678. are not in set A.  For example, `complement ([1, 2, 3], [2, 3, 5])'
  679. returns the value `5'.
  680.  
  681. 
  682. File: octave.info,  Node: Statistics,  Next: Plotting,  Prev: Sets,  Up: Top
  683.  
  684. Statistics
  685. **********
  686.  
  687.    I hope that someday Octave will include more statistics functions.
  688. If you would like to help improve Octave in this area, please contact
  689. `bug-octave@che.utexas.edu'.
  690.  
  691. `corrcoef (X [, Y])'
  692.      If each row of X and Y is an observation and each column is a
  693.      variable, the (i,j)-th entry of `corrcoef (X, Y)' is the
  694.      correlation between the i-th variable in X and the j-th variable
  695.      in Y.  If invoked with one argument, compute `corrcoef (X, X)'.
  696.  
  697. `cov (X [, Y])'
  698.      If each row of X and Y is an observation and each column is a
  699.      variable, the (i,j)-th entry of `cov (X, Y)' is the covariance
  700.      between the i-th variable in X and the j-th variable in Y.  If
  701.      invoked with one argument, compute `cov (X, X)'.
  702.  
  703. `kurtosis (X)'
  704.      If X is a vector of length N, return the kurtosis
  705.  
  706.           kurtosis(x) = N^(-1) std(x)^(-4) SUM_i (x(i)-mean(x))^4 - 3
  707.  
  708.      of X.  If X is a matrix, return the row vector containing the
  709.      kurtosis of each column.
  710.  
  711. `mahalanobis (X, Y)'
  712.      Returns Mahalanobis' D-square distance between the multivariate
  713.      samples X and Y, which must have the same number of components
  714.      (columns), but may have a different number of observations (rows).
  715.  
  716. `mean (A)'
  717.      If A is a vector, compute the mean of the elements of A.  If A is
  718.      a matrix, compute the mean for each column and return them in a
  719.      row vector.
  720.  
  721. `median (A)'
  722.      If A is a vector, compute the median value of the elements of A.
  723.      If A is a matrix, compute the median value for each column and
  724.      return them in a row vector.
  725.  
  726. `skewness (X)'
  727.      If X is a vector of length N, return the skewness
  728.  
  729.           skewness (x) = N^(-1) std(x)^(-3) SUM_i (x(i)-mean(x))^3
  730.  
  731.      of X.  If X is a matrix, return the row vector containing the
  732.      skewness of each column.
  733.  
  734. `std (A)'
  735.      If A is a vector, compute the standard deviation of the elements
  736.      of A.  If A is a matrix, compute the standard deviation for each
  737.      column and return them in a row vector.
  738.  
  739. 
  740. File: octave.info,  Node: Plotting,  Next: Image Processing,  Prev: Statistics,  Up: Top
  741.  
  742. Plotting
  743. ********
  744.  
  745.    All of Octave's plotting functions use `gnuplot' to handle the
  746. actual graphics.  There are two low-level functions, `gplot' and
  747. `gsplot', that behave almost exactly like the corresponding `gnuplot'
  748. functions `plot' and `splot'.  A number of other higher level plotting
  749. functions, patterned after the graphics functions found in MATLAB
  750. version 3.5, are also available.  These higher level functions are all
  751. implemented in terms of the two low-level plotting functions.
  752.  
  753. * Menu:
  754.  
  755. * Two-Dimensional Plotting::
  756. * Three-Dimensional Plotting::
  757. * Miscellaneous Plotting Functions::
  758.  
  759. 
  760. File: octave.info,  Node: Two-Dimensional Plotting,  Next: Three-Dimensional Plotting,  Prev: Plotting,  Up: Plotting
  761.  
  762. Two-Dimensional Plotting
  763. ========================
  764.  
  765.    The syntax for Octave's two-dimensional plotting function, `gplot',
  766. is
  767.  
  768.      gplot RANGES EXPRESSION USING TITLE STYLE
  769.  
  770. where the RANGES, USING, TITLE, and STYLE arguments are optional, and
  771. the USING, TITLE and STYLE qualifiers may appear in any order after the
  772. expression.  You may plot multiple expressions with a single command by
  773. separating them with commas.  Each expression may have its own set of
  774. qualifiers.
  775.  
  776.    The optional item RANGES has the syntax
  777.  
  778.      [ x_lo : x_up ] [ y_lo : y_up ]
  779.  
  780. and may be used to specify the ranges for the axes of the plot,
  781. independent of the actual range of the data.  The range for the y axes
  782. and any of the individual limits may be omitted.  A range `[:]'
  783. indicates that the default limits should be used.  This normally means
  784. that a range just large enough to include all the data points will be
  785. used.
  786.  
  787.    The expression to be plotted must not contain any literal matrices
  788. (e.g. `[ 1, 2; 3, 4 ]') since it is nearly impossible to distinguish a
  789. plot range from a matrix of data.
  790.  
  791.    See the help for `gnuplot' for a description of the syntax for the
  792. optional items.
  793.  
  794.    By default, the `gplot' command plots the second column of a matrix
  795. versus the first.  If the matrix only has one column, it is taken as a
  796. vector of y-coordinates and the x-coordinate is taken as the element
  797. index, starting with zero.  For example,
  798.  
  799.      gplot rand (100,1) with linespoints
  800.  
  801. will plot 100 random values and connect them with lines.  When `gplot'
  802. is used to plot a column vector, the indices of the elements are taken
  803. as x values.
  804.  
  805.    If there are more than two columns, you can choose which columns to
  806. plot with the USING qualifier. For example, given the data
  807.  
  808.      x = (-10:0.1:10)';
  809.      data = [x, sin(x), cos(x)];
  810.  
  811. the command
  812.  
  813.      gplot [-11:11] [-1.1:1.1] data with lines, data using 1:3 with impulses
  814.  
  815. will plot two lines.  The first line is generated by the command `data
  816. with lines', and is a graph of the sine function over the range -10 to
  817. 10.  The data is taken from the first two columns of the matrix because
  818. columns to plot were not specified with the USING qualifier.
  819.  
  820.    The clause `using 1:3' in the second part of this plot command
  821. specifies that the first and third columns of the matrix `data' should
  822. be taken as the values to plot.
  823.  
  824.    In this example, the ranges have been explicitly specified to be a
  825. bit larger than the actual range of the data so that the curves do not
  826. touch the border of the plot.
  827.  
  828.    In addition to the basic plotting commands, the whole range of `set'
  829. and `show' commands from `gnuplot' are available, as is `replot'.
  830.  
  831.    The `set' and `show' commands allow you to set and show `gnuplot'
  832. parameters.  For more information about the set and show commands, see
  833. the `gnuplot' user's guide (also available on line if you run `gnuplot'
  834. directly, instead of running it from Octave).
  835.  
  836.    The `replot' command allows you to force the plot to be redisplayed.
  837. This is useful if you have changed something about the plot, such as
  838. the title or axis labels.  The `replot' command also accepts the same
  839. arguments as `gplot' or `gsplot' (except for data ranges) so you can
  840. add additional lines to existing plots.
  841.  
  842.    For example,
  843.  
  844.      set term tek40
  845.      set output "/dev/plotter"
  846.      set title "sine with lines and cosine with impulses"
  847.      replot "sin (x) w l"
  848.  
  849.    will change the terminal type for plotting, add a title to the
  850. current plot, add a graph of sin (x) to the plot, and force the new
  851. plot to be sent to the plot device.  This last step is normally
  852. required in order to update the plot.  This default is reasonable for
  853. slow terminals or hardcopy output devices because even when you are
  854. adding additional lines with a replot command, gnuplot always redraws
  855. the entire plot, and you probably don't want to have a completely new
  856. plot generated every time something as minor as an axis label changes.
  857.  
  858.    Since this may not matter as much on faster terminals, you can tell
  859. Octave to redisplay the plot each time anything about it changes by
  860. setting the value of the builtin variable `automatic_replot' to the
  861. value `"true"'.
  862.  
  863.    Note that NaN values in the plot data are automatically omitted, and
  864. Inf values are converted to a very large value before calling gnuplot.
  865.  
  866.    The MATLAB-style two-dimensional plotting commands are:
  867.  
  868. `plot (ARGS)'
  869.      This function produces two-dimensional plots.  Many different
  870.      combinations of arguments are possible.  The simplest form is
  871.  
  872.           plot (y)
  873.  
  874.      where the argument is taken as the set of Y coordinates and the X
  875.      coordinates are taken to be the indices of the elements, starting
  876.      with 1.
  877.  
  878.      If more than one argument is given, they are interpreted as
  879.  
  880.           plot (x [, y] [, fmt] ...)
  881.  
  882.      where Y and FMT are optional, and any number of argument sets may
  883.      appear.  The X and Y values are interpreted as follows:
  884.  
  885.         * If a single data argument is supplied, it is taken as the set
  886.           of Y coordinates and the X coordinates are taken to be the
  887.           indices of the elements, starting with 1.
  888.  
  889.         * If the first argument is a vector and the second is a matrix,
  890.           the the vector is plotted versus the columns (or rows) of the
  891.           matrix.  (using whichever combination matches, with columns
  892.           tried first.)
  893.  
  894.         * If the first argument is a matrix and the second is a vector,
  895.           the the columns (or rows) of the matrix are plotted versus
  896.           the vector.  (using whichever combination matches, with
  897.           columns tried first.)
  898.  
  899.         * If both arguments are vectors, the elements of Y are plotted
  900.           versus the elements of X.
  901.  
  902.         * If both arguments are matrices, the columns of Y are plotted
  903.           versus the columns of X.  In this case, both matrices must
  904.           have the same number of rows and columns and no attempt is
  905.           made to transpose the arguments to make the number of rows
  906.           match.
  907.  
  908.           If both arguments are scalars, a single point is plotted.
  909.  
  910.      The FMT argument, if present is interpreted as follows.  If FMT is
  911.      missing, the default gnuplot line style is assumed.
  912.  
  913.     `-'
  914.           Set lines plot style (default).
  915.  
  916.     `.'
  917.           Set dots plot style.
  918.  
  919.     `@'
  920.           Set points plot style.
  921.  
  922.     `-@'
  923.           Set linespoints plot style.
  924.  
  925.     `^'
  926.           Set impulses plot style.
  927.  
  928.     `L'
  929.           Set steps plot style.
  930.  
  931.     `#'
  932.           Set boxes plot style.
  933.  
  934.     `~'
  935.           Set errorbars plot style.
  936.  
  937.     `#~'
  938.           Set boxerrorbars plot style.
  939.  
  940.     `n'
  941.           Interpreted as the plot color if N is an integer in the range
  942.           1 to 6.
  943.  
  944.     `nm'
  945.           If NM is a two digit integer and M is an integer in the range
  946.           1 to 6, M is interpreted as the point style.  This is only
  947.           valid in combination with the `@' or `-@' specifiers.
  948.  
  949.     `c'
  950.           If C is one of "R", "G", "B", "M", "C", or "W", it is
  951.           interpreted as the plot color (red, green, blue, magenta,
  952.           cyan, or white).
  953.  
  954.     `+'
  955.     `*'
  956.     `o'
  957.     `x'
  958.           Used in combination with the points or linespoints styles,
  959.           set the point style.
  960.  
  961.      The color line styles have the following meanings on terminals that
  962.      support color.
  963.  
  964.           Number  Gnuplot colors  (lines)points style
  965.             1       red                   *
  966.             2       green                 +
  967.             3       blue                  o
  968.             4       magenta               x
  969.             5       cyan                house
  970.             6       brown            there exists
  971.  
  972.      Here are some plot examples:
  973.  
  974.           plot (x, y, "@12", x, y2, x, y3, "4", x, y4, "+")
  975.  
  976.      This command will plot Y with points of type 2 (displayed as `+')
  977.      and color 1 (red), Y2 with lines, Y3 with lines of color 4
  978.      (magenta) and Y4 with points displayed as `+'.
  979.  
  980.           plot (b, "*")
  981.  
  982.      This command will plot the data in B will be plotted with points
  983.      displayed as `*'.
  984.  
  985. `hold'
  986.      Tell Octave to `hold' the current data on the plot when executing
  987.      subsequent plotting commands.  This allows you to execute a series
  988.      of plot commands and have all the lines end up on the same figure.
  989.      The default is for each new plot command to clear the plot device
  990.      first.  For example, the command
  991.  
  992.           hold on
  993.  
  994.      turns the hold state on.  An argument of `off' turns the hold state
  995.      off, and `hold' with no arguments toggles the current hold state.
  996.  
  997. `ishold'
  998.      Returns 1 if the next line will be added to the current plot, or 0
  999.      if the plot device will be cleared before drawing the next line.
  1000.  
  1001. `loglog (ARGS)'
  1002.      Make a two-dimensional plot using log scales for both axes.  See
  1003.      the description of `plot' above for a description of the arguments
  1004.      that `loglog' will accept.
  1005.  
  1006. `semilogx (ARGS)'
  1007.      Make a two-dimensional plot using a log scale for the X axis.  See
  1008.      the description of `plot' above for a description of the arguments
  1009.      that `semilogx' will accept.
  1010.  
  1011. `semilogy (ARGS)'
  1012.      Make a two-dimensional plot using a log scale for the Y axis.  See
  1013.      the description of `plot' above for a description of the arguments
  1014.      that `semilogy' will accept.
  1015.  
  1016. `contour (Z, N, X, Y)'
  1017.      Make a contour plot of the three-dimensional surface described by
  1018.      Z.  Someone needs to improve `gnuplot''s contour routines before
  1019.      this will be very useful.
  1020.  
  1021. `polar (THETA, RHO)'
  1022.      Make a two-dimensional plot given polar the coordinates THETA and
  1023.      RHO.
  1024.  
  1025. 
  1026. File: octave.info,  Node: Three-Dimensional Plotting,  Next: Miscellaneous Plotting Functions,  Prev: Two-Dimensional Plotting,  Up: Plotting
  1027.  
  1028. Three-Dimensional Plotting
  1029. ==========================
  1030.  
  1031.    The syntax for Octave's three-dimensional plotting function,
  1032. `gsplot', is
  1033.  
  1034.      gsplot RANGES EXPRESSION USING TITLE STYLE
  1035.  
  1036. where the RANGES, USING, TITLE, and STYLE arguments are optional, and
  1037. the USING, TITLE and STYLE qualifiers may appear in any order after the
  1038. expression.  You may plot multiple expressions with a single command by
  1039. separating them with commas.  Each expression may have its own set of
  1040. qualifiers.
  1041.  
  1042.    The optional item RANGES has the syntax
  1043.  
  1044.      [ x_lo : x_up ] [ y_lo : y_up ] [ z_lo : z_up ]
  1045.  
  1046. and may be used to specify the ranges for the axes of the plot,
  1047. independent of the actual range of the data.  The range for the y and z
  1048. axes and any of the individual limits may be omitted.  A range `[:]'
  1049. indicates that the default limits should be used.  This normally means
  1050. that a range just large enough to include all the data points will be
  1051. used.
  1052.  
  1053.    The expression to be plotted must not contain any literal matrices
  1054. (e.g.  `[ 1, 2; 3, 4 ]') since it is nearly impossible to distinguish a
  1055. plot range from a matrix of data.
  1056.  
  1057.    See the help for `gnuplot' for a description of the syntax for the
  1058. optional items.
  1059.  
  1060.    By default, the `gsplot' command plots each column of the expression
  1061. as the z value, using the row index as the x value, and the column
  1062. index as the y value.  The indices are counted from zero, not one.  For
  1063. example,
  1064.  
  1065.      gsplot rand (5, 2)
  1066.  
  1067. will plot a random surface, with the x and y values taken from the row
  1068. and column indices of the matrix.
  1069.  
  1070.    If parametric plotting mode is set (using the command `set
  1071. parametric', then `gsplot' takes the columns of the matrix three at a
  1072. time as the x, y and z values that define a line in three space.  Any
  1073. extra columns are ignored, and the x and y values are expected to be
  1074. sorted.  For example, with `parametric' set, it makes sense to plot a
  1075. matrix like
  1076.  
  1077.      1 1 3 2 1 6 3 1 9
  1078.      1 2 2 2 2 5 3 2 8
  1079.      1 3 1 2 3 4 3 3 7
  1080.  
  1081. but not `rand (5, 30)'.
  1082.  
  1083.    The MATLAB-style three-dimensional plotting commands are:
  1084.  
  1085. `mesh (X, Y, Z)'
  1086.      Plot a mesh given matrices `x', and Y from `meshdom' and a matrix
  1087.      Z corresponding to the X and Y coordinates of the mesh.
  1088.  
  1089. `meshdom (X, Y)'
  1090.      Given vectors of X and Y coordinates, return two matrices
  1091.      corresponding to the X and Y coordinates of the mesh.
  1092.  
  1093.      See the file `sombrero.m' for an example of using `mesh' and
  1094.      `meshdom'.
  1095.  
  1096. 
  1097. File: octave.info,  Node: Miscellaneous Plotting Functions,  Prev: Three-Dimensional Plotting,  Up: Plotting
  1098.  
  1099. Miscellaneous Plotting Functions
  1100. ================================
  1101.  
  1102. `bar (X, Y)'
  1103.      Given two vectors of x-y data, `bar' produces a bar graph.
  1104.  
  1105.      If only one argument is given, it is taken as a vector of y-values
  1106.      and the x coordinates are taken to be the indices of the elements.
  1107.  
  1108.      If two output arguments are specified, the data are generated but
  1109.      not plotted.  For example,
  1110.  
  1111.           bar (x, y);
  1112.  
  1113.      and
  1114.  
  1115.           [xb, yb] = bar (x, y);
  1116.           plot (xb, yb);
  1117.  
  1118.      are equivalent.
  1119.  
  1120. `grid'
  1121.      For two-dimensional plotting, force the display of a grid on the
  1122.      plot.
  1123.  
  1124. `stairs (X, Y)'
  1125.      Given two vectors of x-y data, bar produces a `stairstep' plot.
  1126.  
  1127.      If only one argument is given, it is taken as a vector of y-values
  1128.      and the x coordinates are taken to be the indices of the elements.
  1129.  
  1130.      If two output arguments are specified, the data are generated but
  1131.      not plotted.  For example,
  1132.  
  1133.           stairs (x, y);
  1134.  
  1135.      and
  1136.  
  1137.           [xs, ys] = stairs (x, y);
  1138.           plot (xs, ys);
  1139.  
  1140.      are equivalent.
  1141.  
  1142. `title (STRING)'
  1143.      Specify a title for the plot.  If you already have a plot
  1144.      displayed, use the command `replot' to redisplay it with the new
  1145.      title.
  1146.  
  1147. `xlabel (STRING)'
  1148. `ylabel (STRING)'
  1149.      Specify x and y axis labels for the plot.  If you already have a
  1150.      plot displayed, use the command `replot' to redisplay it with the
  1151.      new labels.
  1152.  
  1153. `sombrero (N)'
  1154.      Display a classic three-dimensional mesh plot.  The parameter N
  1155.      allows you to increase the resolution.
  1156.  
  1157. `clearplot'
  1158. `clg'
  1159.      Clear the plot window and any titles or axis labels.  The name
  1160.      `clg' is aliased to `clearplot' for compatibility with MATLAB.
  1161.  
  1162.      The commands `gplot clear', `gsplot clear', and `replot clear' are
  1163.      equivalent to `clearplot'.  (Previously, commands like `gplot
  1164.      clear' would evaluate `clear' as an ordinary expression and clear
  1165.      all the visible variables.)
  1166.  
  1167. `closeplot'
  1168.      Close stream to the `gnuplot' subprocess.  If you are using X11,
  1169.      this will close the plot window.
  1170.  
  1171. `purge_tmp_files'
  1172.      Delete the temporary files created by the plotting commands.
  1173.  
  1174.      Octave creates temporary data files for `gnuplot' and then sends
  1175.      commands to `gnuplot' through a pipe.  Octave will delete the
  1176.      temporary files on exit, but if you are doing a lot of plotting
  1177.      you may want to clean up in the middle of a session.
  1178.  
  1179.      A future version of Octave will eliminate the need to use temporary
  1180.      files to hold the plot data.
  1181.  
  1182. `axis (LIMITS)'
  1183.      Sets the axis limits for plots.
  1184.  
  1185.      The argument LIMITS should be a 2, 4, or 6 element vector.  The
  1186.      first and second elements specify the lower and upper limits for
  1187.      the x axis.  The second and third specify the limits for the y
  1188.      axis, and the fourth and fifth specify the limits for the z axis.
  1189.  
  1190.      With no arguments, `axis' turns autoscaling on.
  1191.  
  1192.      If your plot is already drawn, then you need to use `replot' before
  1193.      the new axis limits will take effect.  You can get this to happen
  1194.      automatically by setting the built-in variable `automatic_replot'
  1195.      to `"true"'.  *Note User Preferences::.
  1196.  
  1197. `hist (Y, X)'
  1198.      Produce histogram counts or plots.
  1199.  
  1200.      With one vector input argument, plot a histogram of the values with
  1201.      10 bins.  The range of the histogram bins is determined by the
  1202.      range of the data.
  1203.  
  1204.      Given a second scalar argument, use that as the number of bins.
  1205.  
  1206.      Given a second vector argument, use that as the centers of the
  1207.      bins, with the width of the bins determined from the adjacent
  1208.      values in the vector.
  1209.  
  1210.      Extreme values are lumped in the first and last bins.
  1211.  
  1212.      With two output arguments, produce the values NN and XX such that
  1213.      `bar (XX, NN)' will plot the histogram.
  1214.  
  1215. 
  1216. File: octave.info,  Node: Image Processing,  Next: Input and Output,  Prev: Plotting,  Up: Top
  1217.  
  1218. Image Processing
  1219. ****************
  1220.  
  1221.    To display images using these functions, you must be using Octave
  1222. with the X Window System, and you must have either `xloadimage' or `xv'
  1223. installed.  You do not need to be running X in order to manipulate
  1224. images, however, so some of these functions may be useful even if you
  1225. are not able to view the results.
  1226.  
  1227. `colormap'
  1228.      Set the current colormap.
  1229.  
  1230.      `colormap (MAP)' sets the current colormap to MAP.  The color map
  1231.      should be an N row by 3 column matrix.  The columns contain red,
  1232.      green, and blue intensities respectively.  All entries should be
  1233.      between 0 and 1 inclusive.  The new colormap is returned.
  1234.  
  1235.      `colormap ("default")' restores the default colormap (a gray scale
  1236.      colormap with 64 entries).  The default colormap is returned.
  1237.  
  1238.      With no arguments, `colormap' returns the current color map.
  1239.  
  1240. `gray (N)'
  1241.      Create a gray colormap with values from 0 to N.  The argument N
  1242.      should be a scalar.  If it is omitted, 64 is assumed.
  1243.  
  1244. `gray2ind'
  1245.      Convert a gray scale intensity image to an Octave indexed image.
  1246.  
  1247. `image'
  1248.      Display an Octave image matrix.
  1249.  
  1250.      `image (X)' displays a matrix as a color image.  The elements of X
  1251.      are indices into the current colormap and should have values
  1252.      between 1 and the length of the colormap.
  1253.  
  1254.      `image (X, ZOOM)' changes the zoom factor.  The default value is 4.
  1255.  
  1256. `imagesc'
  1257.      Scale and display a matrix as an image.
  1258.  
  1259.      `imagesc (X)' displays a scaled version of the matrix X.  The
  1260.      matrix is scaled so that its entries are indices into the current
  1261.      colormap.  The scaled matrix is returned.
  1262.  
  1263.      `imagesc (X, ZOOM)' sets the magnification, the default value is 4.
  1264.  
  1265. `imshow'
  1266.      Display images.
  1267.  
  1268.      `imshow (X)' displays an indexed image using the current colormap.
  1269.  
  1270.      `imshow (X, MAP)' displays an indexed image using the specified
  1271.      colormap.
  1272.  
  1273.      `imshow (I, N)' displays a gray scale intensity image.
  1274.  
  1275.      `imshow (R, G, B)' displays an RGB image.
  1276.  
  1277. `ind2gray'
  1278.      Convert an Octave indexed image to a gray scale intensity image.
  1279.  
  1280.      `Y = ind2gray (X)' converts an indexed image to a gray scale
  1281.      intensity image.  The current colormap is used to determine the
  1282.      intensities.  The intensity values lie between 0 and 1 inclusive.
  1283.  
  1284.      `Y = ind2gray (X, MAP)' uses the specified colormap instead of the
  1285.      current one in the conversion process.
  1286.  
  1287. `ind2rgb'
  1288.      Convert an indexed image to red, green, and blue color components.
  1289.  
  1290.      `[R, G, B] = ind2rgb (X)' uses the current colormap for the
  1291.      conversion.
  1292.  
  1293.      `[R, G, B] = ind2rgb (X, MAP)' uses the specified colormap.
  1294.  
  1295. `loadimage'
  1296.      Load an image file.
  1297.  
  1298.      `[X, MAP] = loadimage (FILE)' loads an image and it's associated
  1299.      color map from the specified FILE.  The image must be stored in
  1300.      Octave's image format.
  1301.  
  1302. `ocean (N)'
  1303.      Create color colormap.  The argument N should be a scalar.  If it
  1304.      is omitted, 64 is assumed.
  1305.  
  1306. `rgb2ind'
  1307.      Convert and RGB image to an Octave indexed image.
  1308.  
  1309.      `[X, MAP] = rgb2ind (R, G, B)'
  1310.  
  1311. `saveimage'
  1312.      Save a matrix to disk in image format.
  1313.  
  1314.      `saveimage (FILE, X)' saves matrix X to FILE in Octave's image
  1315.      format.  The current colormap is also saved in the file.
  1316.  
  1317.      `saveimage (FILE, X, "img")' saves the image in the default format
  1318.      and is the same as `saveimage (FILE, X)'.
  1319.  
  1320.      `saveimage (FILE, X, "ppm")' saves the image in ppm format instead
  1321.      of the default Octave image format.
  1322.  
  1323.      `saveimage (FILE, X, "ps")' saves the image in PostScript format
  1324.      instead of the default Octave image format.  (Note: images saved
  1325.      in PostScript format can not be read back into Octave with
  1326.      loadimage.)
  1327.  
  1328.      `saveimage (FILE, X, FMT, MAP)' saves the image along with the
  1329.      specified colormap in the specified format.
  1330.  
  1331.      Note: if the colormap contains only two entries and these entries
  1332.      are black and white, the bitmap ppm and PostScript formats are
  1333.      used.  If the image is a gray scale image (the entries within each
  1334.      row of the colormap are equal) the gray scale ppm and PostScript
  1335.      image formats are used, otherwise the full color formats are used.
  1336.  
  1337. 
  1338. File: octave.info,  Node: Input and Output,  Next: Special Matrices,  Prev: Image Processing,  Up: Top
  1339.  
  1340. Input and Output
  1341. ****************
  1342.  
  1343.    There are two distinct classes of input and output functions.  The
  1344. first set are modeled after the functions available in MATLAB.  The
  1345. second set are modeled after the standard I/O library used by the C
  1346. programming language.  The C-style I/O functions offer more flexibility
  1347. and control over the output, but are not quite as easy to use as the
  1348. simpler MATLAB-style I/O functions.
  1349.  
  1350.    When running interactively, Octave normally sends any output intended
  1351. for your terminal that is more than one screen long to a paging program,
  1352. such as `less' or `more'.  This avoids the problem of having a large
  1353. volume of output stream by before you can read it.  With `less' (and
  1354. some versions of `more') it also allows you to scan forward and
  1355. backward, and search for specific items.
  1356.  
  1357.    No output is displayed by the pager until just before Octave is
  1358. ready to print the top level prompt, or read from the standard input
  1359. using the `fscanf' or `scanf' functions.  This means that there may be
  1360. some delay before any output appears on your screen if you have asked
  1361. Octave to perform a significant amount of work with a single command
  1362. statement.  The function `fflush' may be used to force output to be
  1363. sent to the pager immediately.  *Note C-Style I/O Functions::.
  1364.  
  1365.    You can select the program to run as the pager by setting the
  1366. variable `PAGER', and you can turn paging off by setting the value of
  1367. the variable `page_screen_output' to the string `"false"'.  *Note User
  1368. Preferences::.
  1369.  
  1370. * Menu:
  1371.  
  1372. * Basic Input and Output::
  1373. * C-Style I/O Functions::
  1374.  
  1375.