Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Non linear association

Subject: Non linear association

From: Daniel Robbins

Date: 18 Jan, 2013 21:27:07

Message: 1 of 3

Hi,

I am trying to establish the best way to check the similarity of the pattern of change in two signals/vectors. For a simple example I generated four datasets. One positive parabolic curve, one equal negative curve, one smaller positive curve with a time lag and one vector with a fixed value e.g. [6 6 6 6 6 6 ...etc]. All vectors were the same lengths.

My thinking is that I should use some sort of cross correlation e.g.

[Rxy, Lag] = xcorr(data(:,4),data(:,3));
plot(Lag,Rxy)

By changing the two signals compared I note that the peak of the graph changes location. Therefore I could use the x axis values to calculate the lag in the signal. However I don't understand the values on the Y-axis. I also note that if I input the fixed value vector the graph becomes platykurtic, I'm not sure how to interpret this.

Please can someone help me with the following queries:

1.) How do I interpret the Y-values of the graph?
2.) Is there some way of quantifying the level of agreement in the form of liner correlations e.g. from -1 to 1? Or via p-values?
3.) Is this the best approach to analyse the pattern of change in two non linear signals or is there a better approach?

Many thanks
Dan

Subject: Non linear association

From: Greg Heath

Date: 20 Jan, 2013 12:49:08

Message: 2 of 3

"Daniel Robbins" <d.w.e.robbins@gmail.com> wrote in message <kdcenb$s4n$1@newscl01ah.mathworks.com>...
> Hi,
>
> I am trying to establish the best way to check the similarity of the pattern of change in two signals/vectors. For a simple example I generated four datasets. One positive parabolic curve, one equal negative curve, one smaller positive curve with a time lag and one vector with a fixed value e.g. [6 6 6 6 6 6 ...etc]. All vectors were the same lengths.
>
> My thinking is that I should use some sort of cross correlation e.g.
>
> [Rxy, Lag] = xcorr(data(:,4),data(:,3));
> plot(Lag,Rxy)
>
> By changing the two signals compared I note that the peak of the graph changes location. Therefore I could use the x axis values to calculate the lag in the signal. However I don't understand the values on the Y-axis. I also note that if I input the fixed value vector the graph becomes platykurtic, I'm not sure how to interpret this.
>
> Please can someone help me with the following queries:
>
> 1.) How do I interpret the Y-values of the graph?

If you standardize those columns of data, then the two autocorrelation functions
will have unity peaks at zero lag.

Then you can compare the peak of the crosscorrelation function at zero lag with unity
and how many lags it takes the function to decay to some fraction of the max.

> 2.) Is there some way of quantifying the level of agreement in the form of liner correlations e.g. from -1 to 1? Or via p-values?

Most likely. However, that probably isn't the best approach.

> 3.) Is this the best approach to analyse the pattern of change in two non linear signals or is there a better approach?

I would choose sqrt(mean((y1-y2).^2)), mean(abs(y1-y2)) or max(abs(y1-y2))
 
> Many thanks

You're welcome.

Greg

Subject: Non linear association

From: Daniel Robbins

Date: 20 Jan, 2013 18:24:08

Message: 3 of 3

Hi Greg,

Thanks for the feedback - very helpful!

If I understand your suggestions for my third query correctly, you are using an approach similar to standard or absolute deviations to quantify the amount of variance in a signal? This could be useful for quantifying the consistency of signals; however I am looking to see if the patterns of change in two signals follow a similar style and timescale.

I have been playing with some code to calculate the first derivative of the signals which can then be analysed statistically. Would you say this is a valid approach?

Thanks again
Dan

"Greg Heath" <heath@alumni.brown.edu> wrote in message <kdgp44$o93$1@newscl01ah.mathworks.com>...
> "Daniel Robbins" <d.w.e.robbins@gmail.com> wrote in message <kdcenb$s4n$1@newscl01ah.mathworks.com>...
> > Hi,
> >
> > I am trying to establish the best way to check the similarity of the pattern of change in two signals/vectors. For a simple example I generated four datasets. One positive parabolic curve, one equal negative curve, one smaller positive curve with a time lag and one vector with a fixed value e.g. [6 6 6 6 6 6 ...etc]. All vectors were the same lengths.
> >
> > My thinking is that I should use some sort of cross correlation e.g.
> >
> > [Rxy, Lag] = xcorr(data(:,4),data(:,3));
> > plot(Lag,Rxy)
> >
> > By changing the two signals compared I note that the peak of the graph changes location. Therefore I could use the x axis values to calculate the lag in the signal. However I don't understand the values on the Y-axis. I also note that if I input the fixed value vector the graph becomes platykurtic, I'm not sure how to interpret this.
> >
> > Please can someone help me with the following queries:
> >
> > 1.) How do I interpret the Y-values of the graph?
>
> If you standardize those columns of data, then the two autocorrelation functions
> will have unity peaks at zero lag.
>
> Then you can compare the peak of the crosscorrelation function at zero lag with unity
> and how many lags it takes the function to decay to some fraction of the max.
>
> > 2.) Is there some way of quantifying the level of agreement in the form of liner correlations e.g. from -1 to 1? Or via p-values?
>
> Most likely. However, that probably isn't the best approach.
>
> > 3.) Is this the best approach to analyse the pattern of change in two non linear signals or is there a better approach?
>
> I would choose sqrt(mean((y1-y2).^2)), mean(abs(y1-y2)) or max(abs(y1-y2))
>
> > Many thanks
>
> You're welcome.
>
> Greg

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us