Exploiting and Plot Coherence Function in the Frequency Domain

조회 수: 10 (최근 30일)
Lampros Chantzis
Lampros Chantzis 2019년 2월 27일
편집: Lampros Chantzis 2019년 2월 27일
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개)

카테고리

Help CenterFile Exchange에서 Audio I/O and Waveform Generation에 대해 자세히 알아보기

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by