Consider the 4 following waveform signals:

signal1 = [4.1880   11.5270   55.8612  110.6730  146.2967  145.4113  104.1815   60.1679   14.3949  -53.7558  -72.6384  -88.0250  -98.4607]

signal2 = [ -39.6966   44.8127   95.0896  145.4097  144.5878   95.5007   61.0545   47.2886   28.1277  -40.9720  -53.6246  -63.4821  -72.3029  -74.8313  -77.8124]

signal3 = [-225.5691 -192.8458 -145.6628  151.0867  172.0412  172.5784  164.2109  160.3817  164.5383  171.8134  178.3905  180.8994  172.1375  149.2719  -51.9629 -148.1348 -150.4799 -149.6639]

signal4 = [ -218.5187 -211.5729 -181.9739 -144.8084  127.3846  162.9755  162.6934  150.8078  145.8774  156.9846  175.2362  188.0448  189.4951  175.9540  147.4631  -89.9513 -154.1579 -151.0851]


We notice that signal 1 and 2 look similar and that signal 3 and 4 look similar.

I am looking for an algorithm that take as input n signals and divide them into m groups, where the signals within each group are similar.

First step in such an algorithm would usually be to calculate a feature vector for each signal: $ \mathbf{F}_i $.

As an example we might define the feature vector to be: [width, max, max-min]. In which case we would get the following feature vectors:

$ \mathbf{F}_1 = [13,146,245] $

$ \mathbf{F}_2 = [15,145,223] $

$ \mathbf{F}_3 = [18,181,406] $

$ \mathbf{F}_4 = [18,189,408] $

The important thing when deciding on a feature vector is that similar signals get feature vectors that are close to each other and dissimilar signals gets feature vectors that are far apart.

In the example above we get:

$| \mathbf{F}_2 - \mathbf{F}_1 | = 22.1, |\mathbf{F}_3 - \mathbf{F}_1 | = 164.8 $

We could therefore conclude that signal 2 is much more similar to signal 1 than signal 3 is.

As feature vector I might also use the terms from the discrete cosine transform of the signal. The figure below shows the signals along with approximation of the signals by the first 5 terms from the discrete cosine transform: Cosine transforms

The discrete cosine coefficients in this case are:

F1 = [94.2496  192.7706 -211.4520  -82.8782   11.2105]

F2 = [61.7481  230.3206 -114.1549 -129.2138  -65.9035]

F3 = [182.2051   18.6785 -595.3893  -46.9929 -236.3459]

F4 = [148.6924 -171.0035 -593.7428   16.8965 -223.8754]

In this case we get:

$| \mathbf{F}_2 - \mathbf{F}_1 | = 141.5, |\mathbf{F}_3 - \mathbf{F}_1 | = 498.0 $

The ratio is not quite as large as for the simpler feature vector above. Does this mean that the simpler feature vector is better?

So far I have only shown 2 waveforms. The plot below show some other waveforms that would be the input to such an algorithm. One signal would be extracted from each peak in this plot, starting at the nearest min to the left of the peak and stopping at the nearest min to the right of the peak:Trace

For instance signal3 was extracted from this plot between sample 217 and 234. Signal4 was extracted from another plot.

In case you are curious; each such plot corresponds to sound measurements by microphones at different positions in space. Each microphone receive the same signals but the signals are slightly shifted in time and distorted from microphone to microphone.

The feature vectors could be sent to a clustering algorithm such as k-means that would group together the signals with feature vectors close to each other.

Do any of you have any experience/advice on designing a feature vector that would be good at discriminating waveform signals?

Also which clustering algorithm would you use?

Thank in advance for any answers!

  • $\begingroup$ What about good-'ol dot product of an input signal with one of the M templates? You would take the one that has the least-square-error. That to me would be where I would start. Have you by any chance tried something like that? $\endgroup$
    – Spacey
    Jun 11, 2012 at 14:55
  • $\begingroup$ Hi Mohammad! The problem is that I do not know the waveforms in advance. I am interested in all signals around peaks and they may have many different forms which I don't know in advance. $\endgroup$
    – Andy
    Jun 11, 2012 at 17:29
  • $\begingroup$ What is the reason for trying to find new features to characterise these vectors than using them directly as "features"? (They will have to be the same length though). In the case of k-means clustering the "distances" between those small vectors extracted at the minima of the acquired signals will first be calculated and then the algorithm will try to find a grouping of them into k-sets of minimum variance which is what you seem to be after. $\endgroup$
    – A_A
    Jun 11, 2012 at 23:15
  • $\begingroup$ Hi A_A! 1. The dimensions of the vectors are reduced. In the case of signal 3 from 18 to 5 when using the discrete cosine coefficients. 2. A smoothing is taking place. The signals are noisy, and I am not interested in rapid fluctuations. $\endgroup$
    – Andy
    Jun 12, 2012 at 7:19
  • 3
    $\begingroup$ Machine learning people would argue you should never throw information away - the system should learn on everything. Of course, they're the same people that design algorithms that will take a million years to run, but the point is not without some merit. In essence, you want to throw away as little information as possible and learn on what's left. This strikes me as a problem that should be done in a Bayesian framework (frankly, as most signal processing should be nowadays), though that doesn't mean working out the salient features is not important. $\endgroup$ Jun 14, 2012 at 10:11

1 Answer 1


You want only objective criteria to seperate the signals or is it important that they have some sort of similarity when listened to by someone? That of course would have to restrict you to signals a bit longer (more than 1000 samples).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.