Exploiting and Plot Coherence Function in the Frequency Domain
10 次查看(过去 30 天)
显示 更早的评论
Hello to everyone.
I am currently writing a code for exploiting coherence function through audio signals but I have a problem. I split my signals into frames, apply hanning window filter to each frame, calculate fft for each frame, and then calculate cross spectra density and power spectral density in order to calculate coherence function for each frame (the formula is abs(Pxy)/sqrt(Pxx*Pyy)) . Now I want to cosntruct a coherence vector for the whole signals. Which method sould I use? I try to apply overlap-add but it doesn't seem to produce right results. The coherence function depends on frequency according to theory but the final vector seems to be 0 for frequency in the space (20 Hz - 20KHz). Please help. Thank you in advance.
%l_output: Length of output signal
l_win = 256;
overlap = 0.75*l_win;
offset = l_win-overlap;
index = 1+[0:n_frames-1]*offset;
%coherence: the coherence matrix (m x n) where m: n_frames, n: l_win
%coherence_vector: the large coherence vector for the whole signals
l_output = overlap+n_frames*offset;
coherence_vector = zeros(1,l_output);
%First frame
coherence_vector(index(1):(index(1)+l_win-1)) = coherence(1, :);
%Each successive frame
for n = 2:n_frames
coherence_vector(index(n):index(n)+l_win-1)=coherence_vector(index(n):index(n)+l_win-1)+coherence(n,:);
end
coherence_mag = abs(coherence_vector).^2;
coherence_phase = angle(coherence_vector);
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Audio I/O and Waveform Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!