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 view (last 30 days)
Show older comments
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 Comment
Stephen23
on 1 Oct 2015
Edited: Stephen23
on 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.
Answers (1)
Thorsten
on 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)
0 Comments
See Also
Categories
Find more on Polynomials in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!