Skip to Content
Maestro Docs
Coding and HDL

Octave and Python (SciPy)

Numeric questions on signals, filters and control, in Octave or Python with SciPy.

Some electronics questions ask you to compute a number, such as the gain of a filter at a frequency. You can answer them in Octave or in Python (SciPy), when the question offers both.

Octave

  • The signal and control packages are installed. Load them yourself: put pkg load signal (or pkg load control) at the top of your file.
  • Your file is main.m.
  • Read input from standard input, for example v = fscanf(stdin, '%f');.
  • Print results with printf or disp.

Python (SciPy)

  • Python with NumPy, SciPy and python-control.
  • matplotlib is installed, but plots are not shown to you.
  • Read input from input() or sys.stdin, and print results.

Both

  • Print exactly what the question asks for, such as a number with four decimals.
  • Output is compared with a tolerance, so a result within the stated percentage passes.
  • No other libraries are available, and you can't install packages.
  • The first run can be a little slower while the libraries load.