finding a mathematical function that passes from specified points

17 visualizzazioni (ultimi 30 giorni)
There are some points on X-Y coordinates:
(10,91)
(30,92)
(50,93.2)
(100,93.5)
(125,94)
(250,95.2)
(350,95.4)
(500,95.1)
(550,95)
(750,94.5)
(1000,93.8)
It has been needed to find mathematical function( Y=f(X) ) that passes from above points.And mathematical function must be algebra in this form: y=a+bx^2+cx^3+dx^4+...+nx^K (Not sinusoidal and etc) that a,b,...,n and K are unknown.
There is a command in MATLAB, which named polyfit() but I can't set parameters of that truly. Please help me in finding of this function

Risposta accettata

Paulo Silva
Paulo Silva il 11 Dic 2011
x=[10 30 50 100 125 250 350 500 550 750 1000];
y=[91 92 93.2 93.5 94 95.2 95.4 95.1 95 94.5 93.8];
plot(x,y,'o')
n=8; %try with different n values
p=polyfit(x,y,n);
f = polyval(p,x);
plot(x,y,'o',x,f,'-')
  4 Commenti
mohammad
mohammad il 11 Dic 2011
When n=8, then max degree must be x^8 but in above function there is X^10 ! is this correct?
Paulo Silva
Paulo Silva il 11 Dic 2011
sorry it's wrong and I'm trying to solve it, meanwhile you should use the p variable so y=p(1)*x^8+p(2)*x^7...+p(n)*x^(n-1)

Accedi per commentare.

Più risposte (1)

Walter Roberson
Walter Roberson il 11 Dic 2011
There is no solution to that in the form stated. In order to find a solution, you would need to define a measurement that you could apply to the polyfit() output for various K, to allow you to choose which output was appropriate for your situation.
You will not be able to get a polynomial that fits those points exactly: you are going to encounter round-off error in all the calculations.
When you use a K less than length(X)-1 then polyfit() will do fitting to find the coefficients with minimum total error at the points specified. It is plausible that you might find a K less than length(X)-1 for which the total error is "good enough" for your purposes. (Keep in mind that even with K=length(X)-1 there is going to be error.) But we do not know what your error tolerance is.
  1 Commento
mohammad
mohammad il 11 Dic 2011
Thanks Walter, tolerance could be 0.01 around any above points. OK I'll try varies k value for it.

Accedi per commentare.

Categorie

Scopri di più su Mathematics in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by