for making a polyfit i have to make the dates into a number (unix timebase) then i have the polyfit values that are extrvagant high, so only linear regression is valid.
How can i maket it more suitable to the given datas? SNB.sci (7.1 KB)
When dealing with polynomial approximation, even more when high order is used (6 in your case, which is BTW insane to me), you should normalize the independent variable (let us call it t) as much as possible. For example if the values of t in your dataset (t_1,\dots,t_n) are in [a,b] (in your case you can take a=t_1, b=t_n) you should use the change of variable
s=\frac{t-a}{b-a},
then try to fit the (s_i,y_i)_{i=1,\dots,n} dataset instead of (t_i,y_i)_{i=1,\dots,n}. This is mathematically equivalent, because if you fit a polynomial q(s) vs. (s_i,y_i)_{i=1,\dots,n} then the polynomial p(t) fitting (t_i,y_i)_{i=1,\dots,n} is
p(t) = q\left(\frac{t-a}{b-a}\right),
however, this is not numerically equivalent, as you already experienced it. So you should always normalize the independent variable, at least when its magnitude is large.
No, in the case where the scaling is necessary, forming and returning p(t) computed from q(s) would destroy the benefit of initial scaling. Scaling the data is the user’s task.