>> n=31;%定义滤波器阶数32 fs=12.8*10^3; fc1=49; fc2=51; w1=2*pi*fc1/fs; w2=2*pi*fc2/fs;%参数转换,将模拟滤波器的技术指标转换为数字滤波器的技术指标 window=hanning(n+1);%使用hanning 窗函数 q=fir1(n,[w1/pi w2/pi],hanning(n+1));%滤波器时域函数,使用标准响应的加窗设计函数fir1 w=linspace(0,pi,512); h1=freqz(q,1,512);%进行512 个点的傅里叶变换 figure(2); plot(w/pi,20*log10(abs(h1))); title('滤波器频谱图'); xlabel('频率'); ylabel('幅度'); grid ; 设计FIR 低通滤波器,系统频率为50MHz,通带截止频率Fpass 为1MHz,阻带截止频率Fstop 为4MHz,通带最大衰减Apass 为1dB,阻带最小衰减Astop为30dB。 程序和必要的程序注释 谢谢 最佳答案 只要用一个公式就行。library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity fir is Port (clk: in std_logic; reset: in std_logic; inpx: in std_logic_vector(11 downto 0); outy: out std_logic_vector(11 downto 0)); end fir; architecture beh of fir is signal x0,x1,x2,x3: std_logic_vector(11 downto 0); constant c0:integer :=-1234*32768/1000; constant c1:integer :=2345*32768/10000; constant c2:integer :=5*32768; constant c3:integer :=-3*32768/10000; signal p0,p1,p2,p3:integer; signal sum: integer; begin sample_delay_line: process(clk) begin if rising_edge(clk) then if reset='1' then x3 <=(others=>'0'); x2 <=(others=>'0'); x1 <=(others=>'0'); x0 <=(others=>'0'); else x3 <=x2; x2 <=x1; x1 <=x0; x0 <=inpx; end if; end if; end process; p0 <= conv_integer(x0)*c0; p1 <= conv_integer(x1)*c1; p2 <= conv_integer(x2)*c2; p3 <= conv_integer(x3)*c3; sum <=p0+p1+p2+p3; outy <=conv_std_logic_vector(sum/32768,12); end beh; 4.1 数字滤波器简介 数字滤波器是一种用来过滤时间离散信号的数字系统,通过对抽样数据进行数学处理来达到频域滤波的目的。可以设计系统的频率响应,让它满足一定的要求,从而对通过该系统的信号的某些特定的频率成分进行过滤,这就是滤波器的基本原理。如果系统是一个连续系统,则滤波器称为...