# Equation of nonlinear data

21 views (last 30 days)
Rick on 16 Sep 2014
Answered: Alex Sha on 4 Jun 2019
Hello,
If I have data
rA = [-0.2 -0.0167 -0.00488 -0.00286 -0.00204];
X = [0 0.1 0.4 0.7 0.9];
and I plot
plot(X,-FA0./(rA/60))
xlabel('X')
ylabel('-FA0/rA')
title('FA0/-rA vs. Conversion')
How would I be able to find an equation that represents this non-linear plot? Thanks
I want rA as a function of X
perhaps it would be better visually to see plot(X,rA/60)
which is very nonlinear, but how would I represent this as an equation?
Star Strider on 16 Sep 2014
Looks almost perfectly linear to me (with a scalar ‘FA0’), but we’re missing ‘FA0’. Is it a scalar or vector?
Is there a specific process that generated these data that you want to estimate the parameters for? If so, what is it?

Stephen on 16 Sep 2014
You want to determine a function that matches your data. Doing this really depends on what you know about the data:
• If you know the underlying function, then use this and fit it using least squares , or some tool from the curve fitting toolbox .
• If you do not know the function, then model it using a spline or pchip function, using the polynomial output together with unmkpp .
Stephen on 7 Feb 2015
They are a completely different kind of animal. Just like analytic and numeric calculations, they only bear a passing relation to one another.
"Of course the most suitable mathematical function should best fit the data" sounds nice, but in the real world this is hardly guaranteed. It really depends what you mean by "fit": all data measurements are subject to errors, as are the calculations based on them. For any finite set of data values there are going to be precisely an infinite number of functions that could fit it. How on earth should any program "know" that your data is exponential, or linear, or any other convenient function?
"Also, there is no need to repeat yourself regarding the magic tool", sorry, but there is NO magic tool that can identify what function exactly describes the underlying system of behavior of some set of data.

Alex Sha on 4 Jun 2019
The model function below is good enough, also very simple:
rA = 1/(p1+p2*x);
Root of Mean Square Error (RMSE): 0.000219178990662495
Sum of Squared Residual: 2.4019714973915E-7
Correlation Coef. (R): 0.999997155861087
R-Square: 0.999994311730263
Determination Coef. (DC): 0.999992008454451
Chi-Square: -2.91785095249027E-5
F-Statistic: 375968.944829523
Parameter Best Estimate
---------- -------------
p1 -5.00002149728568
p2 -543.303262063525