因此,我通过降低采样率并通过此代码增加样本数据来解决问题:(如
Matt所述)
Fs = 1000; % Sampling frequency
T = 1/Fs; % Sample time
L = 60000; % Length of signal
t = (0:L-1)*T; % Time vector
for j=1:20
r1 = 5 + (1000-5).*rand(1,1);
r2 = 5 + (1000-5).*rand(1,1);
y = 10*sin(2*pi*14.8*t) + r1*sin(2*pi*14.2*t) + r2*sin(2*pi*15.5*t) + 1.1*rand(size(t));
yfilter = filter(Hd.Numerator,1,y);
max(yfilter(40000:50000))
end
我的过滤器是KAISER(FIR Badpass过滤器):
Fs = 1000; % Sampling Frequency
Fstop1 = 14.2; % First Stopband Frequency
Fpass1 = 14.6; % First Passband Frequency
Fpass2 = 15; % Second Passband Frequency
Fstop2 = 15.2; % Second Stopband Frequency
Dstop1 = 1e-06; % First Stopband Attenuation
Dpass = 0.057501127785; % Passband Ripple
Dstop2 = 1e-06; % Second Stopband Attenuation
flag = 'scale'; % Sampling Flag
% Calculate the order from the parameters using KAISERORD.
[N,Wn,BETA,TYPE] = kaiserord([Fstop1 Fpass1 Fpass2 Fstop2]/(Fs/2), [0 ...
1 0], [Dstop1 Dpass Dstop2]);
% Calculate the coefficients using the FIR1 function.
b = fir1(N, Wn, TYPE, kaiser(N+1, BETA), flag);
Hd = dfilt.dffir(b);
滤波幅度为20次迭代,随机噪声信号为:
max(yfilter(40000:50000))
10.01
10.02
10.01
10.00
10.01
10.03
10.01
10.02
....
对我来说这是一个很好的结果,过滤后的信号是:
但是有一些问题:
1-我的样本数据长度是60000字节,另一方面是1000Hz的采样率,我等待60秒收集数据,这太长时间了!
当我将样本数据长度减少到大约3000个样本时,由于滤波器系数的数量约为4097,滤波结果非常糟糕.
当长度为3000个样本且滤波器系数大约为4097字节时,如何过滤信号?当我减小滤波器的系数时,滤波后的信号结果是如此嘈杂.
2- 15 Hz信号的最佳采样率是多少?
谢谢.