HOW TO KNOW THAT WETHER TWO SIGNLAS ARE SIMILAR OR NOT USING 'XCORR' FUNCTION ????

1 view (last 30 days)
HOW TO KNOW THAT WETHER TWO SIGNLAS ARE SIMILAR OR NOT USING 'XCORR' FUNCTION ????
on the 1st segment of codei i am using two sine waves and in the output i am getting a peaky neature curve in cross corelation;and again if am using two signals like sine and ramp there also i am getting a peaky neature curve in cross corelation;. Then how can i say that whether two are related or not??? how can we predict that these two signals are corelated or not????
t=0:1/100:10;
y=5*sin(t);
w=sin(t);
subplot(3,1,1);
plot(t,y);
grid on;
subplot(3,1,2);
plot(t,w);
grid on;
%FINDING CROSS CORELATION
t=xcorr(y,w);
subplot(3,1,3);
plot(t);
grid on;

Answers (1)

Image Analyst
Image Analyst on 8 Sep 2019
I don't know what a "peaky neature curve" is. If you want to know how well two signals correlate on an element-for-element basis, you can use corrcoeff(). If you want to find out where (what shift) one signal overlaps another best, you can use xcorr. There are some things you need to look out for and be aware of, like xcorr() might indicate a shfit where the ends of the signals are shifted and there's only one - they don't overlap. That might be ok if one signal is much smaller, like it's a template, and you want to find out where in a longer signal it appears. But if the two signals are just two arbitrary signals of about the same length, then I think you better think about what you're asking and what you really need.

Community Treasure Hunt

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

Start Hunting!