Diseño de un filtro FIR
조회 수: 1 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
답변 (1개)
Manikanta Aditya
2024년 7월 3일
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!
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!