Well, this may be too simplistic of an answer, and too complex of a measure, but maybe its worth something.
In order to compare signals, we really have to establish some criterion by which we compare them. This could be so many things. If we want signals that look visually similar, we perform time domain analysis. If we are talking about audio signals that sound similar, we care about frequency or time-frequency analysis. If the signals are supposed to represent noise, then signal variance should be a good measure. In general we may want to use a combination of all sorts of measures. We can do this with a weighted index.
First let's establish what we have: there are two sets of signals: set A and set B. We want some measure that shows set A is different from set B. The signals are detrended.
We take signal a in A and signal b in B. The list of things we can compare:
Similarity in time domain (static): Multiply in place and sum.
Similarity in time domain (with shift*): Take fft of each signal,
multiply, and ifft. (I believe this equivalent to matlab's xcorr.)
Similarity in frequency domain (static**): Take fft of each signal,
multiply, and sum.
Similarity in frequency domain (with shift*): Multiply the two
signals and take fft. This will show if the signals share similar
spectral shapes.
Similarity in energy (or power if different lengths): Square the two
signals and sum each (and divide by signal length for power). (Since
the signals were detrended, this should be signal variance.) Then
subtract and take absolute value for a measure of signal variance
similarity.
* (with shift) -- You could choose to sum over the entire correlation vector to measure total general correlation, you could choose to sum only values in the correlation vector that surpass a certain threshold value (as if you expect echoes of one signal in the other), or just take the maximum value from the correlation vector (where its index is the shift in the second signal that results in maximal correlation with the first signal). Also, if the amount of shift that it takes to reach maximal correlation is important (i.e. if signals are similar only if it takes relatively small shift to reach the point of maximal correlation), then you can incorporate a measure of the index displacement.
** (frequency domain similarity) -- You may want to mask part of the spectrum that you're not concerned with, for instance, if you only care about the more high frequency structures (fs/4 and up), you could do:
mask = zeros(1,n); mask(n/4):
freq_static = mean(fft(a) .* fft(b) .* mask);
Also, we may want to implement a circular correlation like so:
function c = circular_xcorr(a,b)
c = xcorr(a,b);
mid = length(c) / 2;
c = c(1:mid) + c(mid+1:end);
end
Finally, we choose the characteristics that are important or relevant, and create a weighted index. Example:
n = 100;
a = rand(1,n); b = rand(1,n);
time_corr_thresh = .8 * n; freq_corr_thresh = .6 * n;
time_static = max(a .* b);
time_shifted = circular_xcorr(a,b); time_shifted = sum(time_shifted(time_shifted > time_corr_thresh));
freq_static = max(fft(a) .* fft(b));
freq_shifted = fft(a .* b); freq_shifted = sum(freq_shifted(freq_shifted > freq_corr_thresh));
w1 = 0; w2 = 1; w2 = .7; w3 = 0;
index = w1 * time_static + w1 * time_shifted + w2 * freq_static + w3 * freq_shifted;
We compute this index for each pair of signals.
I hope that this outline of signal characterization helps. Comment if anything is unclear.