# bit OT: Multivariable nonlinear regression

• posted
I need to convert some compressor curves into a 3-d equation for modelling
purposes, P = f(Q,V), where P is pressure, Q flow and V a vane position. For
fixed V, the P-Q relationship is well behaved, and monotonic (avoiding the
surge region) within the domain of interest, essentially a segment of a
parabola or cubic. As V varies, the curves shift, rescale and rotate
slightly.
I can generate a table of spot values of the variables, but the regression
functions I've come across such as the Excel linest function, seems to be
confined to linear functions. Can anyone suggest a tool that will faciliate
deriving a polynomial (or other form) equation to model my datasets? The
alternative is the very fiddly process of manually working out variable
coefficients for the constant-V curves that model them as they shift around.
Being a real engineering problem, I'm hoping for a quick and easy solution,
precision isn't essential. otoo +/- 10% would do. TIA
• posted
If you have Scilab or similar, you can get the coefficients of a polynomial pretty quickly.
I.e., if you're looking for a best fit to y(x) = a*x^2 + b*x + c, then make your measurements of y vs. x, put x into a column vector, then do
X = [ones(x) x x.^2]; b = X \ y;
Scilab automatically sees that the problem is overconstrained and finds a least-squares solution for b, which has the coefficients of your polynomial in it.
This code should work the same in Scilab, Octave, and Matlab.