Clear Filters
Clear Filters

Align Signals Using Cross-Correlation

6 views (last 30 days)
Hello, I would like to align arthquake signals from the longest to the shortest component according to the example provided in text file. I have around 95000 earthquake signals with a unified format. Based on oone example, the first row, the second and the third column of the column correspond to the EW, NS and Z components of the earthquake signal according to the script provided in the attachment. Herein, I was trying to aling the signal using "cross correlation" as provided in the following link:
However, I encountered some issues, specially when I want to align the three component of the signals. Apparently, the vertical component presents a missalignment respect the two horizontal components in a sample interval of -7. Following the link it is kind of unclear to mean to align the final components. I would appreciate some help.
Jorge Luis Paredes Estacio
Hi. Thank you for your reply. The example is the txt file attachment. it describes the colums of the text file. The first, the second and the third columns are the EW, NS and Z component of the earthquake signal.The first row and the second are the number of sample and the sample frequency (2255 and 50Hz), respectively. From the thrid row until the last row (from 1 to 2255 sample) are the acceleration in cm/sec2.
(EW) (NS) (Z)
2255 2255 2255 (number of samples of acceleration data)
50 50 50 (sample frequency)
-14.4586 7.7721 -20.8341 (from this row to the last row are the acceleration data in cm/sec2)
12.4724 2.8671 -2.8171
1.8334 -2.9069 1.7489
-8.4166 -7.5169 2.3849
-4.4926 -9.4909 1.5539
-10.8076 -1.1429 1.2399
0.3414 6.2021 -5.5361
2.2824 -2.6879 -5.9981
-11.6456 -10.0839 0.4269
-2.2176 -8.7999 2.9949
12.7924 -5.4689 9.9019
9.4114 2.8821 8.2719
2.7704 13.5541 10.4339
7.1344 12.9461 16.9679
13.6974 -2.4959 18.3259
25.7084 -11.1249 16.4729
31.6264 -6.2229 1.8669
19.7684 -3.0839 -13.2041
20.7744 -5.0879 -16.4081
Jorge Luis Paredes Estacio
The three component of the acceleration (EW, NS and Z) should be aligned in time from the longest to the shortest component in terms of wave arrival.

Sign in to comment.

Accepted Answer

Jon on 12 Jun 2023
Edited: Jon on 12 Jun 2023
I think the problem you are having is that you must figure out how to sort the three signals to determine their arrival order so you know how to trim them. There is enough information to do this knowing only the lags 21, 31, and 32, but exactly how to do this and have it work in general seems like it might be a little tricky. Do you need to do this for many data sets so it has to be automated, or is it just a one time thing and you could do this part manually. For the automated approach you could look at generalized sorting algorithms such as
Or for only 3 elements you could probably come up with an approach on your own.

More Answers (0)




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!