フィルターのクリア

High pass filter lower amplitude of the filtered signal

8 ビュー (過去 30 日間)
Askic V
Askic V 2022 年 12 月 6 日
コメント済み: Askic V 2022 年 12 月 6 日
Inspired by a similar question, can someone please help me understand why amplitudes of the frequencies that are in the pass zone are also decreased?
For example, I have a composite signal consists of 1 Hz and 30 Hz. Amplitude of the 30 Hz signal is 0.5. If I design a filter with cutoff frequency of 15 Hz, output signal which is frequency of 30 Hz is two times lower amplitude.
I wonder why is that. Is it because of the filter's ripple?
clear
clc
close all
fs = 100; % sampling frequency
f1 = 1;
f2 = 30; % frequency of the signal
t = 5; % time duration
n = 0:1/fs:t; % sample period
x1 = sin(2*pi*f1*n); % single tone signal 1 Hz
x2 = 0.5*sin(2*pi*f2*n); % single tone signal 30 Hz
x = x1 + x2; % composite signal contains 1 Hz and 30 Hz
subplot(4,1,1)
plot(n,x)
grid on
title('Composite signal in time domain');
xlabel("time (s)")
ylabel("Signal value")
% Perform FFT and look at the amplitude spectrum
Y = fft(x);
L = length(x);
f = fs*(0:(L/2))/L;
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
Warning: Integer operands are required for colon operator when used as index.
P1(2:end-1) = 2*P1(2:end-1);
subplot(4,1,2)
plot(f,P1)
title("Single-Sided Amplitude Spectrum of x(t)")
xlabel("f (Hz)")
ylabel("|P1(f)|")
% Now design high pass filter to pass all above 7 Hz
fc = 15; % cutoff freq 15 Hz
[b,a] = cheby1(6,5,fc/(fs/2),'high');
xfilt = filtfilt(b,a,x);
subplot(4,1,3)
plot(n,xfilt)
% Perform FFT and look at the amplitude spectrum of filtered signal
Y = fft(xfilt);
L = length(x);
f = fs*(0:(L/2))/L;
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
Warning: Integer operands are required for colon operator when used as index.
P1(2:end-1) = 2*P1(2:end-1);
subplot(4,1,4)
plot(f,P1)
title("Single-Sided Amplitude Spectrum of x(t)")
xlabel("f (Hz)")
ylabel("|P1(f)|")

採用された回答

Bora Eryilmaz
Bora Eryilmaz 2022 年 12 月 6 日
Try instead a filter that is more smooth at the transition region and has less ripple at the left of the high-pass region:
fs = 100;
fc = 15;
[b,a] = butter(6,fc/(fs/2),'high');
freqz(b,a,512,fs)
a = gca;
a.YLim = [-25 0];
The Chebychev filter still has -2.81 dB attenuation at 30 Hz, so you would get an attenuation of
0.5*10^(-2.81/20)
ans = 0.3618
fs = 100;
fc = 15;
[b,a] = cheby1(6,5,fc/(fs/2),'high');
freqz(b,a,512,fs)
a = gca;
a.YLim = [-5 0];
  1 件のコメント
Askic V
Askic V 2022 年 12 月 6 日
Yes, that's it. Thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDigital Filter Analysis についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by