Straight line regression through two or more dimensions

Code for calculating and plotting a straight line through data with correlated uncertainties in two or more dimensions.  This problem is well-known in two dimensions, solved by York (1966, 2004), where it is used by isotope geochemists for straight line fitting though isochrons, fractionation lines, mixing lines, and other linear arrays of measured data.  This contribution produces the same output as a York fit for two dimensions, and is extensible for systems with more than just two variables. 

Paper in Geochimica et Cosmochimica Acta

Code (MATLAB)