FDATOOL
一直不知道怎么调用通过FDATOOL生成的M文件,别人都在讲滤波器怎么设计,我却一直想知道
滤波器怎么用,真可笑了。
Fs = 6000; % Sampling Frequency
Fpass = 560; % Passband Frequency
Fstop = 600; % Stopband Frequency
Dpass = 0.057501127785; % Passband Ripple
Dstop = 0.0001; % Stopband Attenuation
dens = 20; % Density Factor
% Calculate the order from the parameters using FIRPMORD.
[N, Fo, Ao, W] = firpmord([Fpass, Fstop]/(Fs/2), [1 0], [Dpass, Dstop]);
% Calculate the coefficients using the FIRPM function.
b = firpm(N, Fo, Ao, W, {dens})
Hd = dfilt.dffir(b);
以上是通过FDATOOL生成的滤波器
%%===================================================
t = 0 :1/Fs:(1 - 1/Fs)
x = sin(2*pi*550*t)+sin(2*pi*1000*t);
figure plot(x);
y=filter(b,1,x)
figure
plot(y)
未滤波之前的信号
滤波后的信号