I have looked at similar questions on StackOverflow and none seem to address this specifically.
I am trying to find the bin wise phase difference between two signals. To validate if this result is usable the I have introduced a single sample delay between the two signals.
Something like this:
ch1 = randn(frame_length * 100, 1);
ch2 = [0 ; ch1(1:end-1) ];
Thereafter I window the signal, take the FFT and plot the phase diff. Like this:
phase_1 = unwrap(arg(bin_wise_struct.fft_out_ch1));
phase_2 = unwrap(arg(bin_wise_struct.fft_out_ch2));
phase_diff = (phase_1 - phase_2);
However I notice that the final phase difference has random jumps of 2*pi. I would like to know why's this happening despite unwrapping the phase of the original signals.