From: Delta V on
I have two sets of acceleration data, a1 with t1, a2 with t2 from the same object but different accelerometers. Length of data is different so that accelerometers were triggered on and off at different time before and after the event in question.

What is the best method of aligning the data automatically to a common T Zero?
Does a Matlab have a built in function to do this?
From: Walter Roberson on
Delta V wrote:
> I have two sets of acceleration data, a1 with t1, a2 with t2 from the
> same object but different accelerometers. Length of data is different so
> that accelerometers were triggered on and off at different time before
> and after the event in question.
> What is the best method of aligning the data automatically to a common T
> Zero? Does a Matlab have a built in function to do this?

I don't know about the "best" way, but presuming that t1 and t2 are
positive integer time vectors and that t1 and t2 are each in sequence
and have no gaps:

allt = unique([t1,t2]);
tlow = allt(1);
thigh = allt(end);

numt = length(allt);

a1_offset = t1(1) - tlow + 1;
a2_offset = t2(1) - tlow + 1;

a1_aligned = zeros(numt,1);
a1_aligned(a1_offset:a1_offset+length(t1)-1) = a1;

a2_aligned = zeros(numt,1);
a2_aligned(a2_offset:a2_offset+length(t2)-1) = a2;


If t1 and t2 are instead real numbers unless there is a common and
regular time base (e.g., samples every 1/1024 of a second) that can be
reconciled between the two, you need to define how you want the
alignment to proceed. You could perhaps use interp() for your purposes,
but I would be wary of interpolating acceleration data, as it is not
likely to fit the smoothness and continuity models expected by most of
the available interpolating formula.
From: Delta V on
Walter,
thank you for your response.

Since being a millisecond off throws my calculations tremendously is there a way to align a1 and a2 and ignore t1 & t2?

For example when i plot these two acceleration I can see it is same signal but one starts later, amount of time shift varies. I am able to shift one plotted line onto another.

Now i'm looking an automated method of doing this.

Thanks in advance
-V
From: Walter Roberson on
Delta V wrote:

> Since being a millisecond off throws my calculations tremendously is
> there a way to align a1 and a2 and ignore t1 & t2?


> For example when i plot these two acceleration I can see it is same
> signal but one starts later, amount of time shift varies. I am able to
> shift one plotted line onto another.
> Now i'm looking an automated method of doing this.

Possibly xcorr ?

However, I suspect that you might find alignment at the sample level to
be insufficiently precise for your purposes; on the other hand, xcorr
should get you a good starting point for later tweaking.

In order to discard the time information, the implication would have to
be that the interval between samples was constant and the same for both
sets of acceleration data. Is that realistic for your data?