Tuesday, April 20, 2010

Smoothness...

I've done a lot more poking around in MATLAB, and I think that the energy is the best measurement we can use right now. I may post a few plots of the DFT of some of the signals later, but my observation is that it is hard to quantify which parts of the signal are necessary movements and which aren't (the jerks or stop/starts).

However, the energy is a simple measure of the amount of effort required to perform the action. A smooth, quick action will have only the minimal energy required to perform the action, while a slow, jerky action will have much more total energy.

The energy for a signal like this is just the integral of the signal squared, which is closely approximated by the inner (dot) product of the signal with itself. So the following code will give us our smoothness score:

double x_e=0.0,y_e=0.0,z_e=0.0;
for(int i=0;i < A.size();i++)
{
Double[] sample = A.get(i);
x_e+=Math.pow(sample[X],2);
y_e+=Math.pow(sample[Y],2);
z_e+=Math.pow(sample[Z],2);
}
double t_e = x_e+y_e+z_e;


'A' must be the ArrayList of the acceleration signal. Not the double integrated path. You also need add the following somewhere in the same scope:

private static final int X = 0;
private static final int Y = 1;
private static final int Z = 2;

No comments:

Post a Comment