Finding the equation of a curve with given data point in 2D
Show older comments
I have a set of x and y data points and I want to find the equation between x and y. When I plotted the data, it seems it is a cos function stretched and shifted, the data points are for a controller and I am trying to find the relation between voltage and time to see how fast the controller is reacting. I tried curve fitting feature of matlab but that is just for polynomials and other simple functions.
Answers (1)
Walter Roberson
on 28 Aug 2013
0 votes
There are an infinite number of different equations that will perfectly fit any given finite set of points.
If you have a particular model equation, then you may be able to find the coefficients that best fit the data set.
Have you attempted an fft of the data?
2 Comments
Yalda
on 28 Aug 2013
Walter Roberson
on 28 Aug 2013
To me that mostly looks like an exponential, though certainly the leading edge is not.
If it were a modified cos function, then it should be periodic, but as what you show is monotonically increasing there is no obvious justification for suspecting periodicity. This does make a difference because fft() as an analysis technique is not meaningful when the signal is not in principle periodic.
Anyhow, my statement still holds: I could give you an infinite number of different equations that fit the data. What I cannot give you is any way to choose which is the "best" fit amongst that infinite number; the math gives no reason to prefer one to another. However, you might be able to provide some a priori knowledge that would allow us to significantly reduce the possibilities.
Remember, at the moment all you have (in essence) given us is a finite set of (x,y) coordinates. Each member of that set could be converted into a multiple of a Kronecker delta function -- each defining a single exact value but none providing any information about the other values. You might have reason to know that the function is smooth and continuous, but so far we do not (and what reason do you have to be sure that very short duration transient electrical responses will never trigger abnormal behavior?)
Categories
Find more on Linear and Nonlinear Regression 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!