Various trivial code edits, primarily changing 'i' to 'ii' to ensure no conflict with imaginary numbers in MatLab

Signed-off-by: Mark Tompkins <mtompkins@firmusgrp.com>