Está en la página 1de 6

PROCESAMIENTO DIGITAL DE SEALES

DISEO DE FILTROS FIR EN MATLAB


% Diseo del filtro Fir
% especificaciones del filtro LP (SIN NORMALIZAR)
FS = 2*9.14e6;
PASSFREQ = 3.8e6;
STOPFREQ = 5.25e6;
WP = PASSFREQ*2*pi;
Ws = STOPFREQ*2*pi;
RP = 1;
RS = 50;
DP = 1-10^(-RP/20);
DS = 10^(-RP/20);

% especificaciones del filtro LP (NORMALIZADAS)


FS = 1;
PASSFREQ = 0.4157;
STOPFREQ = 0.5744/2;
WP = PASSFREQ*2*pi;
Ws = STOPFREQ*2*pi;
RP = 1;
RS = 50;
DP = 1-10^(-RP/20);
DS = 10^(-RP/20);
% Estimacion del orden minimo que cumple con las especicaciones
fCuts = [PASSFREQ STOPFREQ];
mags = [1 0];
devs = [DP DS];
[Order, Wn, beta, fType] = kaiserord(fCuts, devs, FS);
display('El orden minimo del filtro calculado es: ');
display(Order)
pause
%calculo de los coeficientes del filtro diseado

Num = fir1(Order, Wn, fType, kaiser (Order+1, beta));

%calculo de la respuesta en frecuencia FORMA 1


[H, W] = freqz (Num, 1);
%ESCALA LINEAL
figure
plot (W/pi, abs(H)); grid;
xlabel('Frecuencia normalizadas (*\pi rad/sample)')
ylabel('|H(e^{jw})|');
title('Filtro LP FIR')

%ESCALA LOGARITMICA
figure
plot (W/pi, 20*log10(abs(H))); grid;
xlabel('Frecuencia normalizadas (*\pi rad/sample)')
ylabel('20*log_(10)(|H(e^{jw})|)');
title('Filtro LP FIR')
pause

%CALCULO DE LA RESPUESTA IMPULSIVA % FORMA 1


figure
[h,t] = impz(Num, 1);
plot(t,h); grid;
title('Respuesta impulsiva del filtro LP FIR')

%RESPUESTA DE FASE
figure
plot(W/pi, unwrap(angle(H))); grid;
xlabel('Frecuencia normalizadas (*\pi rad/sample)')
ylabel('Fase H(e^{jw} (rad))');
title('Respuesta de Fase Filtro LP FIR')

%RETRASO DE GRUPO
figure
[gdk, wk] = grpdelay(Num, 1);
plot(wk/pi, gdk); grid;
xlabel('Frecuencia normalizadas (*\pi rad/sample)')
ylabel('Retraso de Grupo (muestras))');
title('Retraso de Grupo Filtro LP FIR)

%CALCULO DE LA RESPUESTA IMPULSIVA FORMA 2

%DELTA
x = zero (1, 1024);
x (1) = 1;

y = filter (Num, 1, x);

figure
plot(y); grid;
title('Respuesta impulsional calculado a travs de la convolucincon delta')

%CALCULO DE LA RESPUESTA EN FRECUENCIA FORMA 2


YY = fft(y);
fyy = 0; (1/length(YY)) : 1-(1/length(YY));
% Escala lineal
figure
plot(fYY, abs(YY)); grid;
title('Filtro LP FIR')

También podría gustarte