Linear fit of independent variables


lewisdrums
01-21-2014, 08:04 AM
Hi there,

I have two tables containing values measured by two different methods, but describing the exact same quantity. I would like to represent them on a classical (x,y) plot, and quantify their similitude.
To do so, I would like to determine the line that best fits simultaneously the two datasets with Matlab, that means by minimizing (least squares) the distance to the line from both x and y coordinates, not only y.
Before, I used the 'polyfit' Matlab function, but it only minimizes the distance of the y data to the line.

So my question: is there a function that already does such a calculation? Or does anyone would have an idea to submit?

Thanks a lot in advance, I've been looking for the answers for weeks!!
Lewis