Page 1 of 1

Polynomial & Exponential Trend

Posted: Tue May 22, 2007 8:33 am
by 9638793
hi there,

Can i generate Polinomial & exponetial Trend line and Equation?

Posted: Thu May 24, 2007 8:07 am
by 9348258
Hi Faruque

The Exponetial Trend function has a CalculateTrend method as Trend function, it works the same way:

Code: Select all

expTrendFunction1.CalculateTrend(expTrendFunction1.Series, 0, expTrendFunction1.Series.Count - 1, ref m, ref b);
label2.Text = "y = " + b.ToString() + "x + " + m.ToString();
For polynomial fitting you should use Steema.TeeChart.Functions.PolyFitting function class. It has a Coefficient(int index) method which returns polynomial coefficients. There is an example of this available in TChart.Net demo. Check the examples under the tab "All Features\Functions\Extended\Polynomial Fitting ", You'll find the demo at TeeChart's program group.

You should be aware of is polynomial coefficents are calculated for scaled x and y values i.e. Y -> Y - Ymin and X -> X - Xmin. This is to avoid fpu when large x or y values are used in series. Internally the algorithm uses Gaussian method to find optimized polynomial coefficients.