您的位置:首页 > 其它

脉冲成形滤波器设计

2011-01-03 16:20 330 查看
用17阶的FIR滤波器

先用mallab产生FIR滤波器的参数和查表法要使用到的初始化数据

y=rcosfir(0.3,2,4,1/1e3,'sqrt');

y =

Columns 1 through 10

0.0283 -0.0191 -0.0768 -0.0974 -0.0375 0.1113 0.3077 0.4752 0.5410 0.4752

Columns 11 through 17

0.3077 0.1113 -0.0375 -0.0974 -0.0768 -0.0191 0.0283

刚刚思考了一下,对于一个5阶的滤波器来说 只有以下几种可能

11111

11110

11100

11000

10000

00000

00001

00011

00111

01111

共10种情况

对于一个13阶梯的滤波器 也只有26种情况

matlab代码如下:

x=[33 -45 -113 -43 202 494 625 494 202 -43 -113 -45 33];
a=[-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1];
for i=1:26
out(i)=a*x';
for j=1:12
a(14-j)=a(13-j);
end

if (i<14)a(1)=1;
else a(1)=-1;
end
a
end
out=floor(out/2017*511)+512;

生成如下的波形:



再做一个ROM:

代码如下:

module rcoslist(
clk,
add,
dataout
);
input clk;
input [12:0]add;
output [9:0]dataout;
reg [9:0]dataout;

always@(posedge clk)
case (add)

13'b0000000000000: dataout<=86;
13'b0000000000001: dataout<=102;
13'b0000000000011: dataout<=80;
13'b0000000000111: dataout<=22;
13'b0000000001111: dataout<=1;

13'b0000000011111: dataout<=103;
13'b0000000111111: dataout<=353;
13'b0000001111111: dataout<=670;
13'b0000011111111: dataout<=920;
13'b0000111111111: dataout<=1023;
13'b0001111111111: dataout<=1001 ;
13'b0011111111111: dataout<=943 ;
13'b0111111111111: dataout<=921 ;
13'b1111111111111: dataout<=937 ;
13'b1111111111110: dataout<=921 ;
13'b1111111111100: dataout<=943 ;
13'b1111111111000: dataout<=1001 ;
13'b1111111110000: dataout<=1023 ;
13'b1111111100000: dataout<=920 ;
13'b1111111000000: dataout<=670;
13'b1111110000000: dataout<=353 ;
13'b1111100000000: dataout<=103;
13'b1111000000000: dataout<=1;
13'b1110000000000: dataout<=22 ;
13'b1100000000000: dataout<=80 ;
13'b1000000000000: dataout<=102;
endcase

测试代码如下:

module rcostest;

// Inputs
reg datain;
reg clock_1k;

// Outputs
wire [9:0] dataout;
wire [12:0] addra;
// Instantiate the Unit Under Test (UUT)
rcosfilter uut (
.datain(datain),
.dataout(dataout),
.clock(clock_1k),
.addra(addra)
);

initial begin
// Initialize Inputs
datain = 0;
clock_1k = 0;
#260 datain=1;
#260 datain=0;
#260 datain=1;
#260 datain=0;
#260 datain=0;
#260 datain=1;
#260 datain=1;
#260 datain=0;
#260 datain=1;
end
always
#10 clock_1k=~clock_1k;

最后用modelsim仿真 波形如下:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: