1
我嘗試模擬噪聲信號並對其進行濾波。信號混合一些低頻信號和一些隨機噪聲。我的目標是獲得14.8Hz的信號。 我的帶通帶寬是14.7Hz到14.9Hz。matlab帶通濾波器不工作
function filteringTest
Hd = KaiserFilter;
Fs = 4000; % Sampling frequency
T = 1/Fs; % Sample time
L = 40000; % Length of signal
t = (0:L-1)*T; % Time vector
r1 = 320;
r2 = 575;
y = 50*sin(2*pi*14.8*t) + r1*sin(2*pi*14.7*t) + r2*sin(2*pi*15.1*t) + 10.1*rand(size(t));
yfilter = filter(Hd.Numerator,1,y);
plot(yfilter)
function Hd = KaiserFilter
Fs = 4000; % Sampling Frequency
N = 4096; % Order
Fc1 = 14.7; % First Cutoff Frequency
Fc2 = 14.9; % Second Cutoff Frequency
flag = 'scale'; % Sampling Flag
Beta = 0.5; % Window Parameter
% Create the window vector for the design algorithm.
win = kaiser(N+1, Beta);
% Calculate the coefficients using the FIR1 function.
b = fir1(N, [Fc1 Fc2]/(Fs/2), 'bandpass', win, flag);
Hd = dfilt.dffir(b);
當我試圖增加濾波器階數從4096到32 * 4096,我得到這樣的結果:
爲什麼此過濾器無法正常工作?我要過濾我的過濾方法嗎? 我應該怎麼做才能獲得14.8Hz的頻率信號?
謝謝。
非常感謝。這行得通! –