FPGA Player

好记性不如烂笔头

导航

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)

 

      未滤波之前的信号

滤波后的信号

 

posted on 2013-06-08 16:36  中国的孩子  阅读(1475)  评论(0编辑  收藏  举报