# How to find a function from real data?

1. Jul 28, 2011

### DrummingAtom

I was driving the other day and thought how I could find the function of my velocity. This would be a rough sketch of data from the velocity of the car. What method could I use to create a function from that graph?

I could assume that the concave parts are x2 then separate them from the flatter parts. That would give me a piecewise function but is there a way to combine all the functions into one?

I drew the red line (y = x) in because that seems like a close approximation. I have learned power and Taylor series but anytime I used those I already knew the function and then came up with the series by taking derivatives. I guess this is more of the numbers only flavor. Any help would be appreciated, thanks.

#### Attached Files:

• ###### CarVelocity.jpg
File size:
8.2 KB
Views:
97
2. Jul 28, 2011

### sir_manning

This sort of analysis is carried out all the time in many subjects (physics, economics, cognitive science, etc.), hence there are multiple techniques. Generally in physics, one at least has an idea of the form of the function and therefore just plays with the parameters until a good fit to the data is found. For example, if I measured the height of everyone in a large classes, I would expect the distribution of their height to follow a Gaussian function, so my two parameters are the mean and standard deviation. Then I could change those until I found a good fit to my data. (Of course, there are better ways to find the parameters than manually changing them.)

I think you are on the right course by trying to model this as piecewise quadratic functions. From your data, it looks like you are changing to progressively higher gears. Each time you do, your acceleration drops to zero (giving a relatively constant velocity for awhile) then begins to increase as the engine gets up to speed.

One useful thing you could do to get a better idea of what is going on is to take the derivative of your data to get the acceleration. Maybe you'll find the acceleration in each gear is a linear function, in which case the use of quadratics for velocity is justified (the integral of a linear acceleration will give you a quadratic velocity). Or maybe you'll find you have to take the derivative of your data again before getting a linear function, in which case your velocity would be best modelled as piecewise cubic functions. Yet perhaps you'll never get a linear function no matter how many derivatives you take, in which case it's more complicated. I don't know how the power output of an engine changes as it gets up to speed.

I doubt you'll be able to get a non-piecewise function that describes this, but you can certainly try. It looks like a linear function multiplied by some kind of periodic function.