A basic implementation of the Bartels-Stewart algorithm in MATLAB