Is it possibe to find the equation from two data vector like x=0 10 20 30 40 50 60 y=78.54 76.19 73.65 70.86 67.72 64.20 60.19

8 vues (au cours des 30 derniers jours)
I have two data obtained from experiment.like x=0 10 20 30 40 50 60 y=78.54 76.19 73.65 70.86 67.72 64.20 60.19 from this data I wanna find the equation
  1 commentaire
Stephen23
Stephen23 le 1 Oct 2015
Modifié(e) : Stephen23 le 1 Oct 2015
There are infinite fucntions that will fit your data, so unless you have some prior knowledge of the model that describes the data then there is no magic tool to discover the best model for some data.
You can easily fit splines, polynomials or lines to model your data.

Connectez-vous pour commenter.

Réponses (1)

Thorsten
Thorsten le 1 Oct 2015
You can use polyfit to fit a polynominal to your data. A polynominal of order 2 gives a nice fit
p = polyfit(x, y, 2);
plot(x, polyval(p, x), 'r')
hold on
plot(x,y, 'k')
And you can have a look a the residuals
residuals = y - polyval(p, x)
The values in p define your equation, e.g.
p(1)*x^2 + p(2)*x + p(3)

Catégories

En savoir plus sur Interpolation dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by