Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. % E5.m PSD parametric estimation for stationary signals
  2. % -----------------------------------------------------------
  3. clear;
  4. T=2000; % number of the input signal samples
  5. K=50; % number of the auto-correlation samples
  6. N=50; % Levinson filter order
  7. %x=gencomp(T,1,T,1,T,1,T,0.1,0.0,0.0);
  8. %x=gencomp(T,1,T,1,T,1,T,0.1,0.2,0.0);
  9. %x=gencomp(T,1,T,1,T,1,T,0.1,0.2,0.3);
  10. x=gencomp(T,1,T,1,T,1,T,0.1,0.5,0.9);
  11. %x = gen(T,0.1,0.15,0.80,0.85);
  12. %[x,fp]=wavread('s1.wav'); % reading a speech sample s1.wav (sampling frequency: fp=12000 Hz)
  13. %T=length(x);
  14. %y=decimate(x,2); % decimation to fp=6000 Hz
  15. %wavwrite(y,fp/2,16,'filename.wav'); % writing a decimated speech sample s1.wav (fp=6000 Hz, quantization 16 bits)
  16. xcentr = cntr(x);
  17. xstand = stnd(xcentr);
  18. [cs,ccs,nccs]=korel(xstand,K);
  19. [rho,A,e] = lev(cs,N);
  20. for i=1:N a(i)=A(i,N); end
  21. for i=N+1:T a(i)=0; end
  22. [Ha,wa] = ampl(a);
  23. H2=Ha.*Ha;
  24. [Wx,wx] = wgmx(xstand);
  25. We=(Wx/max(Wx)).*(H2/max(H2));
  26. for i=1:length(H2) H_2(i)=1/H2(i); end % squared inverse of the Levinson filter magnitude characteristic
  27. y=conv(xstand,A(:,N));
  28. [Wy,wy] = wgmx(y);
  29. %subplot(1,1,1); plot(wa/pi,We/max(We)); title('wgm of output sig'); grid;
  30. %pause
  31. %subplot(1,1,1); plot(nccs,ccs); title('Input signal auto-correlation'); grid
  32. %pause
  33. %subplot(1,1,1); stem(A(:,N)); title('Lev. filter imp. resp.'); grid
  34. %pause
  35. %subplot(1,1,1); stem(rho(2:N)); title('Schur coeff.'); grid
  36. %pause
  37. %subplot(1,1,1); plot(e); title('Least-squares error'); grid;
  38. %pause
  39. %subplot(3,1,1); plot(wx/pi,Wx/max(Wx)); title('Input signal PSD'); grid;
  40. %subplot(3,1,2); plot(wa/pi,Ha/max(Ha)); title('Lev. filter magnitude'); grid;
  41. %subplot(3,1,3); plot(wy/pi,Wy/max(Wy)); title('Output signal PSD'); grid;
  42. %pause
  43. %subplot(2,1,1); plot(wx/pi,log10(Wx/max(Wx))); title('Input signal PSD'); grid;
  44. %subplot(2,1,1); plot(wa/pi,log10(H_2/max(H_2)),'r');
  45. %subplot(2,1,2); plot(wa/pi,log10(H_2/max(H_2))); title('Parametric output signal PSD estimate'); grid;
  46. %subplot(2,1,2); plot(wa/pi,H_2/max(H_2)); title('Parametric output signal PSD estimate'); grid;
  47. %subplot(1,1,1)
  48. subplot(2,1,1);plot(wx/pi,(Wx/max(Wx))); title('input PSD'); grid
  49. subplot(2,1,2);plot(wa/pi,(H_2/max(H_2)),'r'); title ('parmetrized output PSD');grid
  50. pause;
  51. subplot(2,1,1);plot(wx/pi,log10((Wx/max(Wx)))); title('input PSD'); grid
  52. subplot(2,1,2);plot(wa/pi,log10((H_2/max(H_2)),'r')); title ('parmetrized output PSD');grid
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement