Hi Jim, There really isn't a graphic, it's just equations. If you run your example with the first method and get the graph, each set of x,y pairs gets its own LSQ fit line. Instead I want to fit a line to each set of data but the lines have the same slope. There are cases where this makes sense physically. The slope corresponds to the population standard deviation of which there can only be one value. The resulting graph would show a fit line through each set of x,y pairs but the slopes are the identical. There is one LSQ fit that minimizes the error given this constraint. (The error is larger than letting each line have it's own optimal slope of course.) In matlab, you specify a linear equation for each set but the slope variable is the same for both sets. Instead of 4 degrees of freedom you have only 3. Intercept 1, intercept 2 and the slope. But it's very tedious getting data from a datatable, into Matlab and reformatting it so it can be processed by the lsqcurvefit function.
... View more