# Difference equation system identification

Suppose I have a difference equation modeling a vehicle like this:

$$d[k+1]=d[k]+a\cdot u[k]+b,\tag1\label{eq}$$

where $$d[k]$$ is total distance traveled at time $$k$$, $$u[k]$$ is engine input at time $$k$$ (e.g. some measure of engine exertion at that time, not really important exactly what it is), and $$a, b$$ are parameters that I want to estimate from data points that I measure, for example by least squares.

From the difference equation I see that the units of $$a\cdot u[k]$$ and $$b$$ need to be distance. But suppose that the data I gather are actually samples of the vehicle's velocity (not position) for some range of input values, so I can plot velocity vs. engine input.

My question: I'm confused because it seems that it wouldn't make sense to do least squares regression to fit $$a\cdot u[k]+b$$ to these points since that would violate the units, but that is what is done in an example in my course. After the parameters are determined, the example then uses those same parameters to model the distance traveled over time via $$\eqref{eq}$$, going off of some initial starting distance $$d[0]$$. Am I missing something in this example?

• I don't get your point about units. Why would that be a "violation of units"; why does the unit matter? Whether I minimize X in "mm", "km", "horsepowers" or "thrown cats squared per fiscal year" doesn't matter. – Marcus Müller Sep 13 '20 at 9:44
• @MarcusMüller I don't understand why the units wouldn't matter? If I had a graph of thrown cats vs. engine exertion and did regression to find a line of best fit $cats[k] = a*u[k]+b$, wouldn't it be complete nonsense to then expect those same parameters to model the distance traveled, as in the original difference equation? – knzy Sep 13 '20 at 17:30

Note that for a small sampling interval $$T$$, $$\big(d[k+1]-d[k]\big)/T$$ is a good approximation for the velocity. So if you fit $$au[k]+b$$ to a given set of measurements $$v[k]$$, it is valid to conclude
$$d[k+1]=d[k]+T\big(au[k]+b\big)\tag{1}$$
In the text you refer to they might have normalized $$T$$, so it changes the units without changing the values of $$a$$ and $$b$$.