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

1 次查看(过去 30 天)
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 个评论
Stephen23
Stephen23 2015-10-1
编辑:Stephen23 2015-10-1
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.

请先登录,再进行评论。

回答(1 个)

Thorsten
Thorsten 2015-10-1
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)

类别

Help CenterFile Exchange 中查找有关 Polynomials 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by