本设计通过vivado自带fir ip核实现一种低通滤波器 并通过matlab 设计与仿真 验证设计滤波器的正确性
matlab代码如下 :
fs = 100e6 ;
f0 = 100e3 ;
f1 = 600e3 ;
N =32768 ;
a=textread('D:/1.txt','%s');
b=hex2dec(a);%16进制转换成10,字符串也可以转成10进制
for i =1 :159
if b(i) > 2^15 -1
c(i) = b(i) - 2^16 ;
else
c(i) = b(i);
end
end
T = 0: 1/fs : (N-1)/fs ;
sin_oc = sin(2*f0*pi*T) + sin(2*pi*f1*T) ;
sin_oc = round((sin_oc / max(abs(sin_oc)))*(2^15-1));
sin_ocbin = dec2bin(sin_oc + (sin_oc <0)*2^16 );
sinf = filter(c,1,sin_oc);
sinff = 20*log(abs(fft(sinf)))/log(10) ;
ts = 0 : fs/(length(sinff) -1 ) :fs ;
plot(ts,sinff);