[SOLVED] how to find equation for this points

Status
Not open for further replies.

hemnath

Advanced Member level 3
Joined
Jun 24, 2012
Messages
702
Helped
61
Reputation
120
Reaction score
57
Trophy points
1,308
Location
Chennai
Activity points
6,589
i have 5 points.
(0,0.0028), (5, 5.0056), (10, 10.0085), (15, 15.0028), (20, 20.0000)

how to find the equation for this points. what it could be the equation?

Please help.
 

thanks for the link. im looking for the regression algorithms.

if i use fourth order,
y(x) = a0 + (a1X) + (a2 X^2) + (a3 X^3) + (a4 X^4);

but i dono how to calculate values for a0, a1, a2, a3, a4?
please help to calculate these values.

- - - Updated - - -

i dont have experience with matlab. does it necessary to learn matlab? or can we find those values without using matlab?
 

i dont have experience with matlab. does it necessary to learn matlab? or can we find those values without using matlab?
No need to have knowledge in programming in MATLAB neither necessary to know the functions used there; only run the program proposed in the Blog, putting your data as parameters. Take a thorough reading a the article and you will find that is pretty clear.
 

there are cases where i have the values of (0,0.01), (5, 5.0126), (10, 10.0215), (15, 15.0056), (20, 20.0210).

I think, with the regression technique as suggested by andre_teprom, i can approximate the values even closer.

help me to find out values for a0, a1, a2, a3, a4?

- - - Updated - - -

it shows the values in the blog are -33.37, 76.69, -10.11, 0.34. how these values are evaluated?
 

if i use fourth order,
y(x) = a0 + (a1X) + (a2 X^2) + (a3 X^3) + (a4 X^4);

CurveExpert Pro is an easy and inexpensive solution for such tasks
https://www.curveexpert.net/products/curveexpert-professional/

Results with your data from the first post

Final Result [Linear Regressions/Polynomial Regression (degree=4)]:
Equation : a + b*x + c*x^2 + ...
Code:
    a = 2.800000011407233E-03
    b = 9.989599999940542E-01
    c = 5.463333344061239E-04
    d = -5.200000006760561E-05
    e = 1.346666667955809E-06
 

Sorry, I guess my previous post was due to misunderstanding.

Your exponents will not necessarily be greater than 1.

Your first 3 data points create an obvious linear trend. However your last two data points have unexpected low Y values. This suggests the exponent is less than 1.
 


Thanks for the information. I downloaded the software and checked those value.

I have used this values. and substituting x = 10.0085. The output is 10.01700566.

Earlier it was 10.0085. Now it has been increased.

Whether those values are not exact?

But i want the output to approximately 10.00000264(which is very close to 10). I know it can be achieved with regression, but how? my colleague has done it but he has not telling me how he did it. So im searching for a solution.
 

I think the problem specification is incomplete. Besides asking "how to find the equation for this points", you have decide which kind of equation you want. There are some alternatives:
- the one 4th order polynomial that hits all five points (exact solution)
- a lower (first to third) order polynomial that approaches these points with least squared errror (regression)
- any other analytical function that can act as a suitable interpolation (e.g. exponential, logarithmic, whatsover)

The answer depends on your application. If it's a homework excercise, the expected solution type should have been given with the problem.

I use to solve similar fitting problems with a spreadsheet calculator like MS Excel

- - - Updated - - -

The nature of data suggest that it's a linear regression homework problem. See below the trendline fitted by MS Excel. The coefficient of determination is so good (R²= 0,99999986) that a higher order fit makes no sense.

Mathematical methods for regression calculation can be surely found in a highscool math text book.

 

The regression method is just one of the various possible algebraic representation that aims to describe analytically the behaviour of a phenomena, and it is expected an intrinsic error, either due to the resolution of the numbers in some non-float point formatting ( which certainly is not the case ), also due to an error at measured data itself, or even due to the unsuitable model selected, as FvM mentioned, and for each data set you must to perform an interactive refinement, trying out several setup options within the chosen model.

I experienced the same a long time ago, when I chose the 3rd order to create an analog circuit, and during simulations, I realized that the 2nd order that supposedly would be poorest in terms of resolution, was the best one which fit that particular task ( the 3rd order tended to follow the measurement error ).
 

Just write: fit (0,0.0028), (5, 5.0056), (10, 10.0085), (15, 15.0028), (20, 20.0000)

in WolframAlpha

Thanks for the link. But i want polynomial regression. It has only quadratic, cubic, periodic.

For points (0,-0.0028), (5, 5.0028), (10, 10.0085), (15, 15.0085), (20, 20.0028)

Equation : a + b*x + c*x^2 + d*x^3 + e*x^4

I got a = 0.000000000000000E+00
b = 9.992666666666679E-01
c = 3.876666666663420E-04
d = -2.866666666669071E-05
e = 5.733333333341568E-07

When i substitue x = 10.0085, I got 10.0170060541.

My colleague has given me the below values,
a = 0.002797879
b = 0.999566
c = -0.000223561
d = 0.0000192495
e = -0.000000384297

When i substitute these values with x = 10.0085, I got 10.00000264.

How these a,b,c,d,e values are attained? Please help.
 

As previously mentioned, a 4th order polynomial isn't a regression rather than the exact solution. The coefficients can be obtained as solution of a system of linear equations. There's however a problem with calculation accuracy as andre_teprom stated in post #12, if you try it with a solver, you have to assure that the calculation tool uses double precision arithmetics.

Technically, solving the given parameter table with a 4th order polynomial seems arbitrarily useless to me. If you want though, be sure that you understand the principle limitations of numerical methods.
 

Thanks for the link. But i want polynomial regression. It has only quadratic, cubic, periodic.

With a 4 deg polynomial is no longer regression, it's an interpolation.



These coefficients are miscalculated. Never 'a' can be 0.


My colleague has given me the below values,
a = 0.002797879
b = 0.999566
c = -0.000223561
d = 0.0000192495
e = -0.000000384297

When i substitute these values with x = 10.0085, I got 10.00000264.

These values are correct, but unfortunately your colleague round too much in intermediate calculations.
Consequently, only 2 significant digits are OK. Therefore, final error will be greater.

How these a,b,c,d,e values are attained? Please help.

The exact values are:

y = x + (-8.4 + 1.3*x + .673*x^2 - .058*x^3 + .00116*x^4)/3000


Regarding how to calculate the coefficients, you may read something on Wikipedia. But best, read on numerical analysis.
(ie Numerical Recipes **broken link removed** . Older versions are read-free online.
Chapter 3 - Interpolation and Extrapolation )


Alternative for blind calculators, install Matlab and run these 4 lines.

Code:
format long
x = [0,5,10,15,20];                               % Data X
y = [-.0028, 5.0028, 10.0085, 15.0085, 20.0028];  % Data Y
A = polyfit(x,y,4)'                               % Output: [e ; d ; c ; b ; a]
 

Still there is an error.
Please review my comment about calculation accuracy problems. I got similar problems with MS Excel. I believe that Matlab should give better accuracy because it's using double precision float, but I didn't check. Technically it's clear hiw the solution can be obtained, in case of the interpolation problem (4th order poynomial), you get the coeffcients by solving a system of linear equations. Not achieving the expected calculation accuracy hasn't to do with the solution principle.
 

I have used x = 10.0085, I obtained y = 10.01700566.
Still there is an error.

Wow! I have used x=45 and obtained y=45.2948
Yes, still there is an error... You.


Furthermore, your data have much measurement and perhaps typing errors

msg #01: (0, 0.0028), (5, 5.0056), (10, 10.0085), (15, 15.0028), (20, 20.0000)
msg #14: (0,-0.0028), (5, 5.0028), (10, 10.0085), (15, 15.0085), (20, 20.0028)

the las digits are 28,56,85 ==> the resolution is 28 (2*28=56 , 3*28~85)

interpolate a polynomial on points with that resolution is ridiculous ==> should measure N points and fit a polynomial of degree N/2 max.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…