# Alternative Approaches to Polynomial Regression Fit on Sensor A/D Input

I am currently using the output of a polynomial regression to match a pressure sensor's A/D output from pressure and temperature input with a control's pressure output. This approach, with terms up to the 4th degree, works well enough to match the control's output with a reasonable enough error level for my purposes; however, the design matrix containing those polynomial features is extremely unstable and changes the resulting coefficients wildly based on small changes in the input data (e.g. floating point error from different methods of computing the features).

What are some alternative approaches to match my input to the control signal? I'm familiarizing myself with the nomenclature of the field of signal processing, so I'm not too sure what to look for. I have a background in statistics and analytics.

EDIT:

The data is sampled in an equally$$^1$$ spaced mesh the pressure and temperature domains. However, some spots have multiple samples taken. I'm not too sure what the technical signal-to-noise ratio would be, but I can say that there is pressure noise on the order of about $$10^{-5}$$ to $$10^{-3}$$ PSI. I am measuring signals anywhere from -15 PSI to 10,000 PSI.

$$^1$$ : The points, in theory, are uniformly sampled, but there's an uncertainty of about $$10^{-7}$$ PSI in the pressure domain due to the nature of how the measurements are taken from the control. The uncertainty in the temperature domain is unknown, as well, but they are as close to uniform as I can get them.

• are your ADC samples equally-spaced in time? If not, then each sample is associated with a time stamp, correct? Nov 7, 2023 at 20:32
• @robertbristow-johnson They are roughly equally spaced in time, yes, but there is not a time label associated with each data point. They are, however, ordered in time. If necessary, collecting the timestamp in the future would be a trivial task. Nov 7, 2023 at 20:44
• Well, if you're fitting a polynomial to values that are equally-spaced, you get different coefficients than you would if the values were not equally-spaced. "roughly" is in the eye of the beholder. Nov 7, 2023 at 20:47
• @javery In other words: if your data is uniformly sampled, there a much better methods available: band limited interpolation for starters. It would also help to understand what your signal to noise ratio is, what the major noise source and their properties are. The more information about your signal and the noise you have the better an algorithm you can build. "One size fits all" typically doesn't work well here Nov 8, 2023 at 2:37

## 1 Answer

The trouble with looking at polynomial coefficients is that the higher the order, the more sensitive that coefficient is to noise:

$$P(x) = A + Bx + C x^2 + D x^3\tag{1}$$

so one way to approach this is to find cubic (in this case) polynomials that are all well-behaved over the interval of interest and in some sense unrelated to each other.

One set of polynomials that means this criterion is the Legendre Polynomials.

There are found from:

$$L_n(x) = \frac{1}{2^n n!} \frac{d^n}{d x^n} ( x^2 - 1) ^n$$

and then instead of finding $$A$$, $$B$$, $$C$$, and $$D$$ in (1) one finds the coefficients $$E$$, $$F$$, $$G$$, and $$H$$ of the differing order Legendre polynomial:

$$P(x) = E L_0(x) + F L_1(x) + G L_2(x) + H L_3(x)$$

This estimation tends to perform more stably than the direct approach.

Joanna Spanjaard and I used this approach for demodulation of polynomial phase signals using an EKF approach. Published here.

• Thank you for your input. Do you have any good resources to read up on this topic? How would you go about computing the derivative terms? In a regression context, I'm not too sure what to make of that, since there isn't really an ordering of what's "around" the input like you would use in a finite-difference scheme. What about handling interaction terms? I imagine I would have to use some sort of multi-dimensional extension of this model. Or, would I just have to break it into more terms? Nov 7, 2023 at 19:39
• Ignore the bit about the derivatives. That's okay. Nov 7, 2023 at 19:49
• If you want your first derivative to be free of discontinuity, maybe consider Hermite polynomials. Nov 7, 2023 at 20:36