Exploiting and Plot Coherence Function in the Frequency Domain

10 Ansichten (letzte 30 Tage)
Lampros Chantzis
Lampros Chantzis am 27 Feb. 2019
Bearbeitet: Lampros Chantzis am 27 Feb. 2019
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);

Antworten (0)

Kategorien

Mehr zu Audio I/O and Waveform Generation finden Sie in Help Center und File Exchange

Produkte


Version

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by