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

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

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.

Sign in to comment.

Answers (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)

Categories

Tags

Asked:

on 1 Oct 2015

Edited:

on 1 Oct 2015

Community Treasure Hunt

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

Start Hunting!