# 5th order Polynomial not accurate enough?

I have a data plot XY that goes from (X 0-127, Y -70.0 - 6.0 db)

Im using the 5th order polynomial function from plotting this data on this site [http://www.zizhujy.com/en-us/Plotter][1]

However, its not accurate at all at the top end (comes out at 8.5 db when it should be 6 db)

Is there any way of getting a more accurate curve (especially at the top end)? I cant use any more than 5th order polynomial (im using it in a development environment and can only input a set amount of characters)

0   -100
1   -78
2   -66
3   -59
4   -54
5   -50
6   -47
7   -44
8   -42
9   -40
10  -38
11  -36
12  -35
13  -33
14  -32
15  -31
16  -30
17  -29
18  -28
19  -27
20  -26
21  -25
22  -24
23  -24
24  -23
25  -22
26  -21
27  -21
28  -20
29  -20
30  -19
31  -18
32  -18
33  -17
34  -17
35  -16
36  -16
37  -15
38  -15
39  -14
40  -14
41  -13
42  -13
43  -13
44  -12
45  -12
46  -11
47  -11
48  -11
49  -10
50  -10
51  -9.7
52  -9.4
53  -9
54  -8.7
55  -8.4
56  -8.1
57  -7.8
58  -7.5
59  -7.2
60  -6.9
61  -6.6
62  -6.3
63  -6.1
64  -6.1
65  -6.1
66  -6.1
67  -6.1
68  -6.1
69  -6.1
70  -5.2
71  -4
72  -3.7
73  -3.5
74  -3.3
75  -3
76  -2.8
77  -2.6
78  -2.4
79  -2.1
80  -1.9
81  -1.7
82  -1.5
83  -1.3
84  -1.1
85  -0.9
86  -0.7
87  -0.5
88  -0.3
89  -0.1
90  0.1
91  0.3
92  0.5
93  0.7
94  0.8
95  1
96  1.2
97  1.4
98  1.6
99  1.7
100 1.9
101 2.1
102 2.2
103 2.4
104 2.6
105 2.7
106 2.9
107 3.1
108 3.2
109 3.4
110 3.5
111 3.7
112 3.9
113 4
114 4.2
115 4.3
116 4.5
117 4.6
118 4.8
119 4.9
120 5
121 5.2
122 5.3
123 5.5
124 5.6
125 5.7
126 5.9
127 6

• Unless the data are really accurate, I'd go for the (obvious) linear fit... Commented Apr 6, 2014 at 14:04
• What do you mean by top end? At which point do you evaluate the polynomial and get 8.5db instead of 6db? High-order polynomials are notoriously unreliable for extrapolation...
– fgp
Commented Apr 6, 2014 at 14:16
• Linear fit seems worse ( I get 14.3, when it should be 6) By top end I mean 6db. The curve steepens at this point and it seems to throw the prediction of by quite a way (2db in the case of a 5th order) Im evaluating the polynomial at 127, so when x is 127, y is 8.3db, whereas 127 should be 6db. Im wondering why it isnt accurate or how to make it more accurate?
– Ke.
Commented Apr 6, 2014 at 14:18
• Can you post a picture of the plot? I think you might be suffering from overfitting and Runge's phenomenon.
– user856
Commented Apr 6, 2014 at 15:02
• Sure, Ive added the data points to the original question. Then you can just paste them into the zizhujy.com/en-us/Plotter site. If you add 127 into the estimate field, you can see it estimates 8.3db. It comes out exactly the same with my caclulations in excel and also on other online calculators. Im starting to think a higher order is needed. Ive tried an order of 9 and it seems to be better, but not perfect.
– Ke.
Commented Apr 6, 2014 at 15:09

A very good fit is obtained with a function of the form $y=a+b\ln(x+c)$

• hmmn, I wonder how you get the values for a b and c? Also, im a bit stuck with ln. Ive used log10 before, and unfortunately my program doesnt use ln, so not sure how to apply ln to log10 e.g. 20*Log10(x) ?
– Ke.
Commented Apr 6, 2014 at 18:37
• Seems like this is the equation that R would give me, but im still struggling to convert ln function to log10. Is there a simple way of doing this?
– Ke.
Commented Apr 6, 2014 at 19:04
• ln(X)=2.302585 log(X) Commented Apr 6, 2014 at 19:41

You can do it with the zizhujy.com/en-us/Plotter : checkbox "Logarithm fit" (see the result below, very closed to my own result) But this program cannot compute the parameter $c$ . So, I added $c=0.3$ to the input $x$ data. (without a more sophisticated software, anyway you can approximate $c$ by groping).

• ahh this is what ive been looking for all along. Thanks so much JJacquelin. :)
– Ke.
Commented Apr 7, 2014 at 13:36