# Programming

by

## Writing a Processing Sketch to Print Text to the Screen

In order to display text in a processing applet or sketch, one needs to first create a font to use with your sketch. Select Tools > Create Font… from the menu. The dialogue box shown below will appear (Mac OS X version of IDE) select the font and font size and specify the name of

by

## How to Typeset EPS Figures in LaTeX

The extension EPS stands for Encapsulated PostScript and is my favorite filetype for graphics and figures I produce using applications like Illustrator, Inkscape, and MATLAB. Here is how to insert EPS figures into a LaTex document. First you have to use the graphicx package so insert the following after the \documentclass tag and before the

by

## Making (Typesetting) Matrices in LaTeX

Below is code demonstrating how to typeset matrices in LaTeX using the array environment. \begin{displaymath} Q = \left( \begin{array}{ccc} q_{11} & q_{12} & q_{13} \\ q_{21} & q_{22} & q_{23} \\ q_{31} & q_{32} & q_{33} \\ \end{array} \right) \end{displaymath} The code generates a three column matrix with the contents of each column centered ({ccc}).

by

## Making HTML Color ASCII Art with MATLAB

On one warm spring afternoon during grad school when I should have been outside enjoying nature, I stayed in the lab and wrote the following MATLAB script. It will take any 8-bit RGB image and convert it to colored HTML text; any text. As an example of its application I have emblazoned my favorite positronic

by

## Generating Exponentially Distributed Random Numbers in MATLAB

For a recent project one of my research students needed to generate exponentially distributed random numbers in MATLAB. The Statistics Toolbox has a built-in function to do this, but I don’t have a license for this toolbox. Below is the code we wrote. It performs a log transformation to convert a uniformly distributed random number