Thread Subject: Mscoherence function doesnt give good result

Subject: Mscoherence function doesnt give good result

From: Agus Nugroho

Date: 21 Oct, 2011 11:06:10

Message: 1 of 3

Dear all,

I would like to ask you if somebody can help me to check whats the problem in my sample signal.

So lets say I have sample signal as below :

------------------------------------------------------------------------

N=10000;
T=1000;
t=[0:N-1]/N;%interval time
t=t*T;
x1= 2*sin(2*pi*0.5*t)+5*sin(2*pi*0.2*t)+10*sin(2*pi*0.1*t)+20*sin(2*pi*0.05*t);
x2= 5*sin(2*pi*0.2*t)+10*sin(2*pi*0.1*t);

%mscohere function

mscohere(x1,x2,hanning(512),256,512,100)

_-------------------------------------------------------------------------

As you can see, the coherence should points strong peak in frequency 0.2 and 0.1. However, the results that I got was not the same as it should be.

Thank you for any explanation :)

Regards,

Agus

Subject: Mscoherence function doesnt give good result

From: Wayne King

Date: 21 Oct, 2011 11:15:12

Message: 2 of 3

"Agus Nugroho" wrote in message <j7rjn2$ann$1@newscl01ah.mathworks.com>...
> Dear all,
>
> I would like to ask you if somebody can help me to check whats the problem in my sample signal.
>
> So lets say I have sample signal as below :
>
> ------------------------------------------------------------------------
>
> N=10000;
> T=1000;
> t=[0:N-1]/N;%interval time
> t=t*T;
> x1= 2*sin(2*pi*0.5*t)+5*sin(2*pi*0.2*t)+10*sin(2*pi*0.1*t)+20*sin(2*pi*0.05*t);
> x2= 5*sin(2*pi*0.2*t)+10*sin(2*pi*0.1*t);
>
> %mscohere function
>
> mscohere(x1,x2,hanning(512),256,512,100)
>
> _-------------------------------------------------------------------------
>
> As you can see, the coherence should points strong peak in frequency 0.2 and 0.1. However, the results that I got was not the same as it should be.
>
> Thank you for any explanation :)
>
> Regards,
>
> Agus

Hi Agus, The problem is that you have used the incorrect sampling frequency in mscohere().

Your sampling frequency is 10 Hz and you have entered 100 in your call to mscohere.

mscohere(x1,x2,hanning(512),256,512,10)

gives you what you expect.

Hope that helps,
Wayne

Subject: Mscoherence function doesnt give good result

From: Agus Nugroho

Date: 21 Oct, 2011 11:33:10

Message: 3 of 3

Thank you Dr Wayne.

I got better results now.

Thanks again

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

rssFeed for this Thread

Contact us at files@mathworks.com