Filter cutoff frequency correction

Hello, I have this code to make a filter that cuts at 250 Hz and 0.7 amplitude, however, at 250 Hz I have 0.9441. Does anyone know how to correct this?
[b,a]=cheby1(3,0.5,2*pi*250,'s');
H=freqs(b,a,2*pi*[0:500]);
plot(0:500, abs(H))

 Respuesta aceptada

Chunru
Chunru el 27 de Ag. de 2021
Editada: Chunru el 28 de Ag. de 2021
% For digital filter
fs = 1000;
frp = 250; % freq at Rp
[b, a] = cheby1(3, 0.5, frp/(fs/2));
[h, f] = freqz(b, a, 2048, fs);
plot(f, abs(h));
hold on; grid on
% Get the 3db frequency
f3db = interp1(abs(h), f, sqrt(0.5));
% Iterative Correction
while abs(f3db-250)>0.1
frp = frp * (250/f3db);
[b, a] = cheby1(3, 0.5, frp/(fs/2));
[h, f] = freqz(b, a, 2048, fs);
f3db = interp1(abs(h), f, sqrt(0.5));
end
plot(f, abs(h));
plot(f3db, sqrt(0.5), 'o');
legend('Original', 'Corrected', '3dB');
% for analog filter
figure
fh = 250;
epsilon = sqrt(10.^(0.5/10)-1);
f0 = fh/cosh(1/3*acosh(1/epsilon));
[b,a]=cheby1(3,0.5,2*pi*f0,'s');
H=freqs(b,a,2*pi*[0:500]);
plot(0:500, abs(H));
hold on
xline(250)
grid on

4 comentarios

Juan Chehin
Juan Chehin el 27 de Ag. de 2021
freqz is for digital filter, I need for analog filter (freqs)
Chunru
Chunru el 27 de Ag. de 2021
Editada: Chunru el 28 de Ag. de 2021
For analog filter, there is a formula between the f_rp and f3db.
The 3 dB frequency ωH is related to ω0 by:
Given , and ϵ (related to Rp=0.5dB), you can compute .
See above for the update for analog filter.
Juan Chehin
Juan Chehin el 28 de Ag. de 2021
Editada: Juan Chehin el 28 de Ag. de 2021
Are you an envoy of God? This is that I need. Thank you!
Juan Chehin
Juan Chehin el 28 de Ag. de 2021
Another query, for a digital band pass filter between 250 [Hz] and 2000 [Hz], the code would be the same? that is, should I divide each frequency by epsilon?

Iniciar sesión para comentar.

Más respuestas (0)

Productos

Versión

R2014b

Etiquetas

Preguntada:

el 26 de Ag. de 2021

Comentada:

el 28 de Ag. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by