0 like 0 dislike
155 views
Hello!

There is a quadratic function, given as y = 0,5773 * x^2 + 0,6183 * x - 0,0331.
There is point X:
0,057
0,177
0,283
1,087

It's a component Chart. ChartType to set Spline chart.
At the output we get the following picture: That for the extra bend in the graph? How to get rid of it?

Put also the source code.
``public Form1() { double[] X = new double { 0.057, 0.177, 0.283, 1.087 }; double[] Y = new double; for (int i = 0; i < X. Length; i++) Y[i] = CalcPolynom(X[i], new double { -0.0331, 0.6183, 0.5773 }); InitializeComponent(); Series s = chart1.Series; for (int i = 0; i < X. Length; i++) s.Points.AddXY(X[i], Y[i]); } CalcPolynom double(double x, double[] coeffs) { double y = 0; double x_interim = 1; for (int i = 0; i < coeffs.Length; i++) { y += x_interim * coeffs[i]; x_interim *= x; } return y; }``
| 155 views

0 like 0 dislike
Elementary, you declare an array of points, to calculate Y use a different set of values (an anonymous array of 3 values: new double { -0.0331, 0.6183, 0.5773 }) - abstract the second point is slightly to the right than the last.
by

0 like 0 dislike