We Recommend

Circuit Design with VHDL Circuit Design with VHDL
This textbook teaches VHDL using system examples combined with programmable logic and supported by laboratory exercises. While other textbooks concentrate only on language features, Circuit Design with VHDL offers a fully integrated presentation of VHDL and design concepts by including a large number of complete design examples, illustrative circuit diagrams, a review of fundamental design concepts, fully explained solutions, and simulation results.


Posted By

yuconner on 08/10/06


Tagged

filter audio dsp


Versions (?)


Who likes this?

2 people have marked this snippet as a favorite

yuconner
zdroshnya


Digital low pass filter (first order)


Published in: MatLab 


URL: http://audiores.uint8.com.ar/blog/?p=20

It's a simple low pass filter with comparative graphs.

  1. function [ salida ] = pasabajos(nombre)
  2. %Filtro pasabajos de 1er orden:
  3.  
  4. [X,Fs,bits] = wavread(nombre); %carga el wav
  5. FX = fft(X);
  6. Xmed=mean(X); %debe dar 0
  7. Xvar=var(X);
  8.  
  9. pfiltro = [1 1]; %orden 1, promediador de 2 muestras: y[n]=(x[n]+x[n-1])/2
  10.  
  11. Y=1/2*filter(pfiltro,[1],X);
  12. FY = fft(Y);
  13.  
  14. N=length(FX);
  15. if ( mod(N,2) == 0 )
  16. t=N/2;
  17. else
  18. t=floor(N/2)+1;
  19. end
  20. rectaFrec=linspace(0,pi*Fs/(2*pi),floor(N/2)+1);
  21.  
  22. FX = fftshift(FX);
  23. FY = fftshift(FY);
  24.  
  25. subplot(2,1,1)
  26. title(’Original’)
  27. Espectro=abs(FX(t:N));
  28. plot(rectaFrec,Espectro,’r'); %Grafico en funcion de la frecuencia en Hz
  29.  
  30. subplot(2,1,2)
  31. title(’Pasabajos de 1er orden’)
  32. Espectro=abs(FY(t:N));
  33. plot(rectaFrec,Espectro,’b'); %Grafico en funcion de la frecuencia en Hz
  34.  
  35. salida = Y;

Report this snippet 

You need to login to post a comment.