StianØyna

Software developer, Norway

Projects / 2026

Mini MATLAB

A MATLAB interpreter written in TypeScript that runs in the browser, with plotting.

Open projectView source

A simplified MATLAB interpreter of about 3,000 lines of TypeScript with no runtime dependencies. The playground has a script editor, a command window with a >> prompt and a workspace table, all running locally in your browser.

What it covers:

  • Double, logical and char matrices, cells, structs and function handles, with MATLAB’s indexing rules: end, logical masks, growth on assignment and deletion.
  • Operators with implicit expansion, and linear algebra including A\b, LU, QR and eigenvalues.
  • Scripts with local functions, closures, nargin/varargin, persistent/global and try/catch.
  • About 300 built-ins, from polyfit and regexp to cellfun and sprintf.
  • Plotting rendered to SVG: plot, scatter, bar, histogram, stem, subplot, legend, log axes and TeX-style labels.

Not supported: complex numbers, N-D arrays, classes, and 3-D or surface plots.

The playground includes a searchable function reference covering all 370 built-ins and the basics of the language. Every entry has a runnable example, and the output shown next to it is produced live by the interpreter. Typing help name at the prompt prints the same entry.

The interpreter also runs as a command-line REPL in Node, with a test suite of 134 tests.