Can we use xcorr() for continuous signals

4 views (last 30 days)
Sadiq Akbar
Sadiq Akbar on 24 May 2021
Edited: Sadiq Akbar on 24 May 2021
If we have two continuous signals as below: Then can we use xcorr() to find the correlation between them?
close all; clc; clearvars;
w = [pi/4 pi/4 pi/2]'; % Frequency
P = length(w); % Number of signals
N=10; % Number of data points in the generated signals
S=2*exp(1j*(w*(1:N))); % Three signals generated
x=S(1,:);
y=S(2,:);
[Cxy,F] = mscohere(x,y) % Coherence between x and y signals computed
figure('name', 'Coherence')
plot(F,Cxy)
title('Magnitude-Squared Coherence')
xlabel('Frequency (Hz)')
grid
[r,lags] = xcorr(x,y)
When two signals have different frequenies, they are called Uncorrelated signals.Likewise same frequency signals are called correlated signals.
Similarly when two signals start from same point, then they are coherent signals but if they start from different point, then they are non-coherent signals. In the above command [Cxy,F] = mscohere(x,y)
what is Cxy and what is F. Where is the starting point of the two signals stored here?
Likwise where is the frequency stored in the command [r,lags] = xcorr(x,y) as it finds correlation.

Answers (0)

Community Treasure Hunt

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

Start Hunting!