## General Mechanical

Topics relate to Mechanical Enterprise, Motion, Additive Print and more

#### Polynomial equation for curves

• Shravani Bojja
Subscriber

Dear Team,

is there any possibility in Ansys workbench (or via APDL command snippets) that we can get a polynomial equation (of a user defined degree) for different curves?

For example, for 3 different design points, 3 different displacements curves are obtained (at 3 different loads). For these 3 curves, I would like to generate a polynomial equation such that the coefficients obtained from this equation can be used further.

Best Regards,

Shravani

• Aniket
Ansys Employee

can you explain your question in more detail?

-Aniket

How to access Ansys help links

Guidelines for Posting on Ansys Learning Forum

• Shravani Bojja
Subscriber

Hi Aniket,

Suppose I have 3 curves (ex: position v/s displacement) for 3 different design points of a model, and if i put those curves in an excel, I could get polynomial equations for these three curves. In the same way do we have an option in Ansys workbench (directly or via command snippets) to get a polynomial equation for the curves? so that I can make use of the coefficients of the equations for further calculation. I have attached a sample excel calculation showing the polynomial equation generation.

Please let me know if you have any queries.

Thanks,

Shravani

• Shravani Bojja
Subscriber

Hello All,

can I get some information for the above query please?

Best Regards,

Shravani

• mjmiddle
Ansys Employee

There is nothing in Mechanical for this. Even in Excel, curve fitting is not entirely automatic. You have to choose curve type, such as logarithmic, exponential, or polynomial, etc... For polynomial, you then must choose an order (2-6). We do have some curve fitting in the Engineering Data for material models to fit test data. But you wrote that this is for displacement. If this is a displacement load you can define by equation with a variable of "time":

If you are trying to curve-fit displacement or deformation output data, you could do it by script. You could do it in the "Automation > Scripting" console in Mechanical or insert a "Python Code" object under Solution. Your code would have to get the displacement data either from a native result in Mechanical or get the raw data, and your code would have to handle the curve fitting. Or you could just use a native deformation result in Mechanical, and right click on it to "Export > Export Text File" and then do the curve fitting in Excel.