Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Curve fitting

6 REPLIES 6
Reply
Message 1 of 7
Anonymous
3338 Views, 6 Replies

Curve fitting

Is it possible to use autocad for curve fitting? I have data in excel which have to be fitted with minimal changes. Fitting data at same time effects changing of many curves. I have to find approximation. Is it possible to import data in AC and fit curves and data? Or do you know for other program that might be useful? Fitting by changing data manually is very time consuming and imprecise. Thank you

Tags (1)
6 REPLIES 6
Message 2 of 7
TheCADnoob
in reply to: Anonymous

There is a fairly simple way to do it. check out this Autodesk Knowledge Network Article:  https://knowledge.autodesk.com/support/autocad/troubleshooting/caas/sfdcarticles/sfdcarticles/Draw-p...

CADnoob

EESignature

Message 3 of 7
Anonymous
in reply to: TheCADnoob

Hello!

First of all, thanks for replying. I am not sure if you understood me
correctly. The problem is not in drawing curves with given formula. I have
data that form a curve and I need to adjust them so they represent a nice
curve but with minimal changes. Beside that changing one data changes more
curves. So I have to change data as minimal as possible and in that way so
that all the curves are smooth (best approximation is polynomial curve 4
degrees).

There is a file with non fitted data attached.

Kind regards,

Ana Zajec
Message 4 of 7
TheCADnoob
in reply to: Anonymous

The second part of the AKN link shows how to put data points into CAD... If you are responding through emails, attachments will not make it into the forums. 

CADnoob

EESignature

Message 5 of 7
leeminardi
in reply to: Anonymous

Since you have the data in Excel why not use Excel's curve fitting feature to fit a 4th order polynomial to the data?  You can then use Excel to generate a bunch of points defined by the coefficients of the fit curve.  You can use a script (created by using Excel's concatenate command) to enter the point data into AutoCAD.

 

lee.minardi
Message 6 of 7
Anonymous
in reply to: leeminardi

Hello!

Thanks for replying. The problem is that my curve is not defined by
coefficients but by the bunch of data that need to be fixed in order to fit
the curves. I do not know the equation of current curve (except if I use
trend line option I get approximate). I need to get fixed data.
Message 7 of 7
leeminardi
in reply to: Anonymous

I am not sure how much you understand about curve fitting so please excuse me if I simplify this too much.  

 

In general, curve fitting does not generate an equation that will exactly place a curve through every data point. The objective of curve fitting is to create a curve that is a "best fit". The technique seeks to minimize the error between the data points and the curve (equation) that approximates the data.  To place a curve exactly though a set of data with a polynomial the order of the polynomial will usually need to be one less than the number of data points.  For example, a straight line (order 1) can exactly pass through any 2 points, a parabola (order 2) through 3 points. A 14th order polynomial can pass through 13 points but it may have a lot of ripples in it so in general it is best to use the lowest order polynomial possible when curve fitting if you want a "nice" smooth curve.

 

The Excel Trendline feature does curve fitting and gives you several options for the type of curve to fit to the data including linear, polynomial, exponential and others.  It also gives you the coefficients of the resulting fit and a measure of how well the curve fits the data.

 

Assuming that you have more than 5 data points and you want to fit a 4th order polynomial, as you stated, to the data the resulting curve will not pass through every data point.  Once you have determined the equation of the curve using Trendline you would then generate a series of points in Excel that reference the curve fit equation.  You can then transfer those points to AutoCAD with a simple script to generate a polyline of the fit curve. Since the "curve" in AutoCAD is a polyline it will be a series of straight line segments that have, to whatever precision you need,  the shape of the curve.  

 

AutoCAD does not have a feature for directly entering the coefficients of an equation to generate a curve.  AutoCAD splines (NURBS) can exactly represent any shaped curve but it can be difficult to go from a polynomial expression to the equivalent NURBS. It is interesting to note that the polyline splines created by splining a polyline will yield a 3rd order B-spline that can exactly duplicate a parabola if the polyline had 4 control vertices but not a circle, ellipse or hyperbola since a parabola is the only conic section that can be expressed as a polynomial.

 

If you would like to post the data you would like to fit with a curve I will take a stab at doing the curve fit and transferring it to AutoCAD.

 

~Lee 

lee.minardi

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report