some routines for MathLab (or Octave)