Curve Fitting Algorithm - Lisp
Dear Forum,
Does any one have a Lisp routine for the best fit curve through a set of points. I know there are methods like "Least Square" and others. Any pointer or help appreciated.
Best Regards
Rakesh Rao
Smarter .dwg CAD
0
Comments
-
Is using the Fit functionality of the _PEDIT command an option?0
-
Roy,
I have a dispersion of points with different densities and need to derive a trend line out of it, one that follows or represents the most dominant points, the kind you see in some Excel spreadsheets which statisticians use.
Best Regards
Rakesh Rao
Smarter .dwg CAD0 -
Aha, that is a different story. Sorry, I can't help you with that.0
-
Hi Rakesh,
have a look at Lee Mac's code and comments :
http://www.cadtutor.net/forum/showthread.php?76647-Build-an-average-line-from-a-family-of-points
I have tested it myself and it works fine...BUT only for simple linear regression !
In any case curve fitting to points is always based on the "statistical or geometrical fitting" method and therefore you should
define it in Lisp or find it it in Internet somewhere...it is not just one algorithm like the Voronoi solution!
You find the test code and drawing in the attachment. Just run the TESTLR (Linear Regeression) command on a subset(s) of points in the drawing
You get a different Ray every time...
I hope this helps
Best Regards
konstantinCurve_Fitting.pdfSimple Linear Regression.LSPLinear_Regression.dwg
0 -
0
-
Does the estimation have to occur within the CAD environment? There are powerful open-source tools, e.g., R which can easily handle the task.
I'm not lisp-savvy enough to know how to link the two. Write a temp file, invoke R on that file which writes another temp file, which is read back in?0 -
@Konstantin: Many thanks for the links. Well check them out.
@Richard: Many users are not competent enough to take data from CAD and process it elsewhere to get the necessary results. The best is if we can provide it in one single environment.
Best Regards
Rakesh Rao
Smarter .dwg CAD0 -
check also the codes primarily at
http://www.theswamp.org/index.php?topic=43914.msg492542#msg492542
for least square polynomial
and secondary at
http://www.theswamp.org/index.php?topic=45659.msg508091#msg508091
http://www.theswamp.org/index.php?topic=45589.msg508090#msg508090
Best Regards0
This discussion has been closed.