algorithm - How to fit the 2D scatter data with a line with C++ -
I used to work with MATLAB, and for the question I raised, I p = polyfit (x, y, 1) To estimate the best fit line for scatter data in the plate I can use, I was wondering which resources I can rely on to implement line fitting algorithm with C ++. I think there are so many algorithms for this topic, and for me, I hope the algorithm should be fast and during this time it can achieve comparative accuracy of the polyphonic function in MATLAB.
I suggest coding it from scratch. This is a very simple implementation in C ++. You can code sources directly from your data for intercept and gradients (both code as polyfit ) for at least classes
These forms close formulas, which you can easily use the loop. If you were using high degree then I would recommend a matrix library or a more sophisticated algorithm, but for simple linear regression, as you say above it, you need it matrix and linear algebraic routine such problem (my opinion In) will end.
Comments
Post a Comment