Notes for producing clean plots in Matlab for LaTeX

Remarkably, MATLAB does not have in-built support for exporting figures as EPS files with placeholders plus a TEX file (hence allowing LaTeX to do the typesetting).  But there are some user-submitted scripts.  The most promising looks to be matlabfrag.

After producing a figure in MATLAB, output an  .eps and a .tex file like this:

set(gca, 'TickDir', 'out', 'XColor', [0.25 0.25 0.25], 'YColor', [0.25 0.25 0.25]);
set(gca, 'YLim', [0 200], 'YTick', [0 100 200], 'YTickLabel', []);
box off; % remove axes on right and top
pos = get(gcf, 'position');
set(gcf, 'position', [pos(1:2),5 ,5]); % make figure 5cm x 5cm
matlabfrag('filename'); % export a .tex and a .eps file using matlabfrag
                        % do not specify a suffix

And then in the LaTeX document use \psfragfig{filename} (no suffix; just the base of the filename) to insert the figure. You'll also need to add \usepackage{graphicx} and \usepackage{pstool} to the LaTeX file's preamble.



Re-installing Windows Vista x64 Media Center

update 13/11/2014 We got the dreaded "component registration failure" message again. has a few good ideas on how to fix this issue. The fix that worked for me was to delete recordings.xml. No need to re-install Vista. Phew! The old post is below.

Fixing a waterlogged iPhone 3GS

About a week ago, my wife's iPhone 3GS found its way into the washing machine and spent a good 15 minutes being washed before it was rescued.  We eventually got it to work this morning.  I'll quickly describe what we tried; what worked and what didn't work.

moving photos from Gallery2 to Flickr

From about 2003 until today, I kept my photos in a variety of places. Most of my photos were on my old website's photo gallery which ran the excellent Gallery2 software. For a number of reasons, I decided to move all my photos to my Flickr account. (I wanted to make use of the community features on flickr, I was failing to keep my Gallery2 install updated and my Android phone makes it really easy to upload photos direct to Flickr).

A better central heating control system

Update: The following blog describes my "ideal" central heating system; the idea being that I'd build this myself if I got the time. It looks like I won't get the time to build this any time soon so I've started looking at off-the-shelf solutions. My research on off-the-shelf solutions is detailed here.

UK Smart Meters: sample rate and reactive power

I've been doing some research on exactly what parameters UK smart meters will record.

I've found DECC's "Functional Requirements Catalogue".

These are proposed requirements rather than confirmed requirements but, none the less, they are useful.

Response to DECC's Smart Metering Implementation Programme: consultation on draft licence conditions and technical specification

Consultation question 24: Do you think that there are other requirements that the Government should adopt in the SMETS? Please explain your reasoning.

Make reactive power readings available over the HAN/WAN

Solar-powered rainwater pump

I plan to build (or buy) a solar-powered pump to take water from our main rainwater tank uphill to the top of the garden.  This second tank would then be able to gravity-feed a hose pipe for watering the garden, instead of having to use watering cans (I'm lazy).

Links for solar-powered rainwater pumps:

LaTeX, Lyx, MetaUML & Zotero on Ubuntu

Lyx is an open-source word processor built on top of LaTeX and Zotero is modern, open-source bibliography management package with "cloud" features. MetaUML is a system for creating UML diagrams in LaTeX (it's frankly pretty painful to use but it does produce professional looking results). This post is where I keep my notes about installing and configuring LaTeX, Lyx and Zotero on my Ubuntu system at Imperial (where I do not have root access).

Linux Home Theatre PC notes

We have had a HTPC as our main source of TV content since about 2006.  We started with MediaPortal but I couldn't get that stable so we switched to Vista Media Center which does actually work quite well but I've always wanted to try to put Linux on our HTPC.  Below are my notes.


Subscribe to RSS - blogs