7
$\begingroup$

I have two plots, each having frequency as x-axis and Gain as y-axis. By taking one data set as a reference I have to calculate similarity between them.

The graphs have same values on the x-axis and have same range on the x axis

Can 2D Correlation or Co-variance can do a decent job ? or should I opt for Fréchet distance or DWT as I have read in some other posts ?

The first plot is the reference plot.

Here are the plots:

Reference figureFigure 2

Please help!

$\endgroup$
  • $\begingroup$ Can you show us the plots? Then we might have some idea what "similar" means in this context. $\endgroup$ – endolith Apr 18 '13 at 13:14
  • $\begingroup$ I have uploaded the plots. The first one is the reference plot! $\endgroup$ – Animesh Pandey Apr 18 '13 at 13:57
  • $\begingroup$ Those don't look similar at all. Do you think that they are? In what way? $\endgroup$ – endolith Apr 18 '13 at 14:50
  • $\begingroup$ but there could be some metric by which we can find the degree of difference between the two ? .. just like Peter K. has mentioned below ... $\endgroup$ – Animesh Pandey Apr 18 '13 at 16:40
  • $\begingroup$ In what way are they similar? That's what you have to answer. $\endgroup$ – endolith Apr 18 '13 at 19:55
5
$\begingroup$

Why not just use something like the relative "error" between the two?

For example, if your frequency magnitude responses are $G_1$ and $G_2$, then calculate:

$$ ERR = \sum \left | G_1(n) - G_2(n) \right|^2 $$

and then normalize with respect to the reference, $G_1$:

$$ NORMALIZED = \sum \left | G_1(n) - G_2(n) \right|^2 / \sum \left | G_1(n) \right|^2 $$

Correlation is also a way to go, but it might show some cases where the same shape happens, but at very different frequencies... which might not be what you want.

$\endgroup$
  • $\begingroup$ I have different Gain values at same frequency points ... I hope I can still apply this concept for Gain values ! $\endgroup$ – Animesh Pandey Apr 18 '13 at 18:11
  • $\begingroup$ I am not sure what you mean? You should probably apply the above to the actual gain values, rather than to the dB values of your plots; other than that, I can't see a big problem (though I might not get precisely what your question is, feel free to elaborate). $\endgroup$ – Peter K. Apr 18 '13 at 19:16
  • $\begingroup$ I tested you solution on other data sets as well I am getting satisfactory results ... I think I should mark this as solution $\endgroup$ – Animesh Pandey Apr 18 '13 at 19:19
  • $\begingroup$ Can I say that the similarity of the graphs is 1.0 - Error , in some way ?? $\endgroup$ – Animesh Pandey Apr 18 '13 at 19:21
  • 2
    $\begingroup$ Yes, that's a way to put it. The error is relative to the $G_1$ energy. It might be true, however, that $ERR > 1.0$, in which case your "similarity" will be negative. If the shape of the curves, rather than the gain is important, then you should normalize them somehow before applying the formulae here. $\endgroup$ – Peter K. Apr 18 '13 at 19:23
3
$\begingroup$

I would use correlation for simple and small data. If your data is large though, I would think about using feature extraction via ICA or PCA analysis, and then compare the features via correlation.

The problem with correlation is scale. Look at the image in the URL below:
Correlation examples

80% is pretty similar in my imagination, but in correlation it really isn't that similar. So, if I were you I would define my own scale of similarity, situated closer to 95-100% on the correlation scale.

And I agree with lxop, in that a correlation between 2 1D signals is enough, given of course that each successive sample index corresponds to the same X-value (frequency) in both signals.

$\endgroup$
  • $\begingroup$ The data has 400 points. Would it be considered large? $\endgroup$ – Animesh Pandey Apr 18 '13 at 13:58
  • $\begingroup$ What if I normalize the graphs and then find the Pearson Correlation between the y-axes vectors of the graphs ? $\endgroup$ – Animesh Pandey Apr 18 '13 at 14:36
  • $\begingroup$ @AnimeshPandey, I would not consider that large at all (hundreds of thousands is more like it). Consider Peter K.'s last recommendation, as it is true. Still, in that case you could measure the phase difference between the two (if they are similar enough) and check for close to zero phase difference. $\endgroup$ – jhc Apr 18 '13 at 17:48
0
$\begingroup$

What's wrong with just normal 1D correlation? That's what it finds - the similarity between two signals ('plots'), at a range of offsets.

The other answer to your question is :

  • What exactly do you mean by 'similarity'? Because that will define how you calculate it.
$\endgroup$
  • $\begingroup$ By similarity I mean how similar they look... $\endgroup$ – Animesh Pandey Apr 18 '13 at 1:55
  • 2
    $\begingroup$ @AnimeshPandey How similar is a red pen on my desk to a USB drive in your backpack? $\endgroup$ – lxop Apr 18 '13 at 4:06
  • 1
    $\begingroup$ @AnimeshPandey You could calculate the percentage overlap in their external colour profiles, or you could use a metric based on their geographic locations, or you could give a ratio of their overall volume, or you could calculate the difference between the proportion of steel to plastic in their construction. Or you could work out how much time in an average day they spend moving. The word 'similar' (and similarity) doesn't have one distinct meaning. $\endgroup$ – lxop Apr 18 '13 at 4:10
  • 1
    $\begingroup$ @AnimeshPandey in the context of two signals, they could 'look similar' because they have the same average value, or because they start and end at the same level, or because their variances are the same, or because they contain the same dominant frequencies. $\endgroup$ – lxop Apr 18 '13 at 4:12
  • 1
    $\begingroup$ The plots must have the nearly the same shape to that of the reference plot. i.e. number of peaks, points where peaks occur etc should be nearly the same. $\endgroup$ – Animesh Pandey Apr 18 '13 at 5:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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