当前位置:   article > 正文

基于频率滑动广义互相关的信号时延估计方法(MATLAB R2018A)_广义互相关时延估计gcc程序

广义互相关时延估计gcc程序

广义互相关(Generalized Cross-Correlation, GCC)方法是一种改进的互相关分析技术,用于更准确地估计信号的时间延迟。这种方法特别适用于噪声环境中的时延估计,因为它通过特定的加权处理提高了互相关函数的峰值的显著性,从而更容易准确地确定时延。

提出一种基于频率滑动广义互相关的信号时延估计方法,压缩包=程序+数据+参考文献。

demo代码如下:

  1. clear all;
  2. set(0,'defaulttextinterpreter','latex')
  3. close all;
  4. load teo4.mat
  5. x1 = x(:,4);
  6. x2 = x(:,1);
  7. SNR = 25;
  8. Px = 0.5*(mean([x1(:); x2(:)].^2));
  9. Pn = Px*10^(-SNR/10);
  10. rng('default')
  11. x2 = x2 + sqrt(Pn)*randn(size(x2));
  12. x1 = x1 + sqrt(Pn)*randn(size(x1));
  13. trueTDOA = 92;
  14. %% Short-Time Windowing
  15. wlen = 2048;
  16. hop = 512;
  17. w = hann(wlen);
  18. x1ef = enframe(x1,w,hop).';
  19. x2ef = enframe(x2,w,hop).';
  20. %% Compute FS-GCC for three speech frames (39, 35 and 55)
  21. Nfft = 2048;
  22. B = 128;
  23. M = 32;
  24. ntest = [39, 35, 55];
  25. Ntest = length(ntest);
  26. for n = 1:Ntest
  27. %% Compute FS-GCC Matrix
  28. xinput = [x1ef(:,ntest(n)), x2ef(:,ntest(n))];
  29. [FSGCCmat,lags,tpwin] = msrpfsgcc(xinput,Nfft,B,M);
  30. figure(1), subplot(3,4,(n-1)*4+1);
  31. imagesc(lags,[],abs(FSGCCmat.'));
  32. xticks([-200 -100 0 100 200])
  33. pbaspect([1 1 1])
  34. xlim([-200 200])
  35. xlabel('$\tau$')
  36. ylabel('$l$');
  37. if n == 1
  38. title({'FS-GCC','','$|\mathbf{R}|^{T}$'});
  39. else
  40. title('$|\mathbf{R}|^{T}$');
  41. end
  42. %% Compute Conventional GCC-PHAT
  43. GCC = fftshift(real(ifft(exp(1i*angle(fft(xinput(:,1),Nfft).*conj(fft(xinput(:,2),Nfft)))))));
  44. figure(1), subplot(3,4,(n-1)*4+2);
  45. GCCn = GCC/max(GCC);
  46. plot(lags,GCCn);
  47. hold on, line([trueTDOA trueTDOA],[min(GCCn) 1],'color','red');
  48. axis tight;
  49. xlim([-200 200])
  50. xticks([-200 -100 0 100 200])
  51. pbaspect([1 1 1])
  52. xlabel('$\tau$')
  53. if n == 1
  54. title({'Conventional GCC-PHAT','',''});
  55. end
  56. %% Compute SVD FS-GCC
  57. [GCCsvd,lags] = getsvdfsgcc(FSGCCmat,200);
  58. figure(1), subplot(3,4,(n-1)*4+3);
  59. GCCsvdn = GCCsvd/max(GCCsvd);
  60. plot(lags,GCCsvdn);
  61. hold on, line([trueTDOA trueTDOA],[min(GCCsvdn) 1],'color','red');
  62. axis tight;
  63. pbaspect([1 1 1])
  64. xlabel('$\tau$')
  65. if n == 1
  66. title({'SVD FS-GCC','',''});
  67. end
  68. %% Compute WSVD FS-GCC
  69. [GCCwsvd,lags] = getwsvdfsgcc(FSGCCmat,tpwin,200);
  70. figure(1), subplot(3,4,(n-1)*4+4);
  71. GCCwsvdn = GCCwsvd/max(GCCwsvd);
  72. plot(lags,GCCwsvdn);
  73. hold on, line([trueTDOA trueTDOA],[min(GCCwsvdn) 1],'color','red');
  74. axis tight;
  75. pbaspect([1 1 1])
  76. xlabel('$\tau$')
  77. if n == 1
  78. title({'WSVD FS-GCC','',''});
  79. end
  80. end

程序出图如下:

工学博士,担任《Mechanical System and Signal Processing》审稿专家,担任
《《控制与决策》,《系统工程与电子技术》,《电力系统保护与控制》等EI期刊审稿专家。
擅长领域:现代信号处理,机器学习,深度学习,数字孪生,时间序列分析,设备缺陷检测、设备异常检测、设备智能故障诊断与健康管理PHM等。

本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号