2
0

lsp_pdf.m 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. % lsp_pdf.m
  2. % David Rowe 2 Oct 2009
  3. % Plots histograms (PDF estimates) of LSP training data
  4. function lsp_pdf(lsp)
  5. [r,c] = size(lsp);
  6. % LSPs
  7. figure(1);
  8. clf;
  9. [x,y] = hist(lsp(:,1),100);
  10. plot(y*4000/pi,x,"+;1;");
  11. hold on;
  12. for i=2:5
  13. [x,y] = hist(lsp(:,i),100);
  14. legend = sprintf("+%d;%d;",i,i);
  15. plot(y*4000/pi,x,legend);
  16. endfor
  17. for i=6:c
  18. [x,y] = hist(lsp(:,i),100);
  19. legend = sprintf("+%d;%d;",i-5,i);
  20. plot(y*4000/pi,x,legend);
  21. endfor
  22. hold off;
  23. grid;
  24. % LSP differences
  25. figure(2);
  26. clf;
  27. subplot(211)
  28. [x,y] = hist(lsp(:,1),100);
  29. plot(y*4000/pi,x,"1;1;");
  30. hold on;
  31. for i=2:5
  32. [x,y] = hist(lsp(:,i) - lsp(:,i-1),100);
  33. legend = sprintf("%d;%d;",i,i);
  34. plot(y*4000/pi,x,legend);
  35. endfor
  36. hold off;
  37. grid;
  38. subplot(212)
  39. [x,y] = hist(lsp(:,6)-lsp(:,5),100);
  40. plot(y*4000/pi,x,"1;6;");
  41. hold on;
  42. for i=7:c
  43. [x,y] = hist(lsp(:,i) - lsp(:,i-1),100);
  44. legend = sprintf("%d;%d;",i-5,i);
  45. plot(y*4000/pi,x,legend);
  46. endfor
  47. hold off;
  48. grid;
  49. % LSP differences delta from last frame
  50. lspd(:,1) = lsp(:,1);
  51. lspd(:,2:10) = lsp(:,2:10) - lsp(:,1:9);
  52. [m,n] = size(lspd);
  53. lspdd = lspd(5:m,:) - lspd(1:m-4,:);
  54. figure(3);
  55. clf;
  56. subplot(211)
  57. for i=1:5
  58. [x,y] = hist(lspdd(:,i),100);
  59. legend = sprintf("%d;%d;",i,i);
  60. plot(y*4000/pi,x,legend);
  61. hold on;
  62. endfor
  63. hold off;
  64. grid;
  65. axis([-200 200 0 35000]);
  66. subplot(212)
  67. for i=6:10
  68. [x,y] = hist(lspdd(:,i),100);
  69. legend = sprintf("%d;%d;",i-5,i);
  70. plot(y*4000/pi,x,legend);
  71. hold on;
  72. endfor
  73. hold off;
  74. grid;
  75. axis([-200 200 0 16000]);
  76. figure(4);
  77. clf;
  78. plot((4000/pi)*(lsp(2:r,3)-lsp(1:r-1,3)))
  79. endfunction