Why Coherence function is one when we consider full length of signal (without segmentation) ?

2 views (last 30 days)
Hi everyone,
I am trying to understand coherence function and its calculation. I am completely new to it and kind of confuse with the results. I am trying to see how coherence value change for a non-linear system without noise.
Here is the my code:
M=40000;
L=1;
dt=L/M;
%frequencies
f1=25; f2=100; f3=f1+f2; f4=f2-f1; f5=2*f1; f6=2*f2;
e=0.1;
%Amplitude
A1=0.8; A2=0.6; A0=0.5*e*(A1^2+A2^2); A3=e*A1*A2; A4=A3; A5=0.5*e*A1^2; A6=0.5*e*A2^2;
K=0.6;
t = -L/2:dt:L/2-dt;
%%Sine wave:
x1=A1*sin(2*pi*f1*t);
x2=A2*sin(2*pi*f2*t);
x3=A3*sin(2*pi*f3*t);
x4=A4*sin(2*pi*f4*t);
x5=A5*sin(2*pi*f5*t);
x6=A4*sin(2*pi*f6*t);
x =x1+x2; %Input
y=K*(A0+x1+x2+x3+x4+x5+x6); %Output
%% Coherence Calculation with Matlab Function
freq = [0:1/L:(1/(2*dt))];
Fs=1/dt;
[Cxy,f]=mscohere(x,y,[],0,freq,Fs);
[Cxy1,fx1]=mscohere(x,y,rectwin(M),0,freq,Fs);
[Cxy4,fx4]=mscohere(x,y,rectwin(8000),2100,freq,Fs);
I tried calculating Coherence function with default value and different window sizes. if I choose window size as odd no. I find coherence is dropped at harmonics and other non-linear frequencies with some additional dips with specific periodicity. But if I choose the window of length equal to length of signal it gives coherence value equal to 1. Please if someone can tell me the reason behind it? If there is any good references to understand the concept?

Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!