Clear Filters
Clear Filters

Diseño de un filtro FIR

8 views (last 30 days)
Alejandra Fuentes Viñegla
Answered: Manikanta Aditya on 3 Jul 2024 at 6:35
L= 5 M= 3 %Obtenga el valor de la frecuencia de corte del filtro fc = min(0.5/M , 0.5/L) N = 60 % Orden del filtro %Calculo de los coeficientes del filtro con la función fir1, %tenga en cuenta que debe multiplicar por 2 el valor de fc B = fir1(N,2*fc) %Obtenga la respuesta en frecuencia con freqz A= 1 [H,W] = freqz(B,A) % Convierta W a frecuencia normalizada f = W/(2*pi) % Representación en escala lineal figure(1) %inserte aqui la instruccion con el plot plot(f,H) title('Respuesta en frecuencia (escala lineal)') xlabel('Frecuencia normalizada') ylabel('abs(H)') % Convierta el resultado a dBs Hdb = 20*log10(abs(H)) %Representación en dBs figure(2) %inserte aqui la instruccion con el plot plot(f,Hdb) title('Respuesta en frecuencia (escala dBs)') xlabel('Frecuencia normalizada') ylabel('abs(H) (dB)') %Una vez ejecute el script descomente la siguiente linea y completela con el valor observado el la grafica minAtenuacion= 52.3626

Answers (1)

Manikanta Aditya
Manikanta Aditya on 3 Jul 2024 at 6:35
Hi,
Here is the MATLAB code for designing an FIR filter:
L = 5;
M = 3;
% Obtain the value of the filter cutoff frequency
fc = min(0.5/M, 0.5/L);
N = 60; % Filter order
% Calculation of the filter coefficients with the function fir1
% Note that you must multiply the value of fc by 2
B = fir1(N, 2*fc);
% Obtain the frequency response with freqz
A = 1;
[H, W] = freqz(B, A);
% Convert W to normalized frequency
f = W / (2*pi);
% Representation on linear scale
figure(1);
plot(f, abs(H));
title('Frequency response (linear scale)');
xlabel('Normalized frequency');
ylabel('abs(H)');
% Convert the result to dBs
Hdb = 20*log10(abs(H));
% Representation in dBs
figure(2);
plot(f, Hdb);
title('Frequency response (dBs scale)');
xlabel('Normalized frequency');
ylabel('abs(H) (dB)');
% Once you run the script, uncomment the following line and complete it with the value observed in the minAttenuation graph
% minAttenuation = 52.3626;
I hope this helps!

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!