0

I'm new to dsp.stackexchange and digital signal processing. I'm required to develop an app to measure the similarity of two signals.for an example I need to compare breathing of a man whether it is abnormal or normal. I have recorded two breathing signals.

Relative error of two signals

I have compared two signals and obtained correlation of two signal. It gives crazy result (because I'm using Android phone it might contain noise). I would like to calculate the relative error of two signals. In the above link there is an answer on how to get the relative error. But I can't understand the formula. I have two double arrays containing values after doing FFT. I'm stuck at applying above formula. How can I go through this?

  • Please do not ask questions which are just following up the answer to a different question. If you cannot follow the answer in the associated question please follow it up there. – PAK-9 Jun 08 '14 at 14:20
  • I'm really sorry about that. but I had not enough reputation to add a comment there.I'm extremely sorry about that. – Thusitha Niroshan Jun 08 '14 at 15:04

1 Answers1

0

So from the other post your error is:

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

To calculate this should be quite simple. Do an element wise subtraction to get the difference between the two frequency responses at each point. Then square each element (magnitude squared if you have any imaginary components for some reason). Then sum over all the elements to get the total difference/error.

As mentioned in the other post you probably want to normalise this by the reference signal to make detecting abnormality easier.

Similarly you could just take the absolute difference rather than squaring. Squaring is more conventional though as it emphasises big differences more and is related to the variance.

nivag
  • 715
  • 3
  • 9
  • Thank you sir for the quick reply. I will accept this answer as soon as I'm done with coding. even though you have explained this concept very well . thank you again sir. – Thusitha Niroshan Jun 07 '14 at 12:51