Comparing fft of wavefiles

3 views (last 30 days)
Anurag Pujari
Anurag Pujari on 16 Feb 2013
I have to compare fft's of two wave files.What are the procedures to do so?Is there any predefined function for finding euclidean distance between two vectors in MATLAB?

Answers (1)

Wayne King
Wayne King on 16 Feb 2013
yes, there are, but what are you trying to achieve. Do you know about coherence? Coherence is a frequency-domain measure of correlation. The values are between 0 and 1 (as opposed to [-1, 1] for the "usual" correlation). If you have the Signal Processing Toolbox, mscohere() computes the magnitude-squared coherence.
t = 0:0.001:1-0.001;
x = cos(2*pi*100*t)+0.5*cos(2*pi*200*t-pi/4)+randn(size(t));
y = 0.8*sin(2*pi*100*t)+0.75*sin(2*pi*200*t-pi/8)+randn(size(t));
[Cxy,F] = mscohere(x,y,200,100,200,1000);
plot(F,Cxy)
The above plot clearly shows that both x and y have coherent frequency content at 100 and 200 Hz.

Tags

Community Treasure Hunt

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

Start Hunting!