插值滤波相关文档.docx

上传人:牧羊曲112 文档编号:5304195 上传时间:2023-06-24 格式:DOCX 页数:8 大小:352.59KB
返回 下载 相关 举报
插值滤波相关文档.docx_第1页
第1页 / 共8页
插值滤波相关文档.docx_第2页
第2页 / 共8页
插值滤波相关文档.docx_第3页
第3页 / 共8页
插值滤波相关文档.docx_第4页
第4页 / 共8页
插值滤波相关文档.docx_第5页
第5页 / 共8页
亲,该文档总共8页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

《插值滤波相关文档.docx》由会员分享,可在线阅读,更多相关《插值滤波相关文档.docx(8页珍藏版)》请在三一办公上搜索。

1、上篇文字里面,我们说到了 FIR滤波器,接下来我们在此处讨论一下插值滤波。这个话题属于多速率信号处理的范畴,经典的参考读物有杨小牛老师的软件无 线电原理与应用以及Fredric J. Harris所著的 通信系统中的多采样率信 号处理,这两位都是通信行业中的大腕,前者曾是中电科36所的所长,这个 所在嘉兴,是国内电子对抗领域的翘楚。后面一位更加厉害,高通公司用他的名 字在圣迭戈州立大学设立了一个奖学金。数字上、下变频是软件无线电领域里面非常重要的一个分支,以数字上变频来说, 关键技术就是插值滤波和DDS技术。插值滤波技术,也叫做上采样,或采样率提 升,为什么这个技术很重要呢,请自行搜索“软件无

2、线电 插值滤波器”。根据小牛老师的书,信号N倍插值之后的频谱会出现N个镜像。于是呢,需要用 滤波器来把镜像频率除去,插值滤波器常用的有2个系列,FIR和CIC,其中FIR 主要用于小倍率的插值,而CIC则用于大倍率的插值,比如说,参照以下ADI 的经典芯片AD9857,里面用FIR做了 4倍插值,用CIC做2-63倍插值,这是因 为FIR需要进行大量乘加,但是滤波性能好,而CIC不用乘法,但是只能抑制镜 像频率附近的信号频带,并且CIC的通带内衰减较快,所以CIC适合用在高采样 率的一端,关于CIC先不多说,此处专注FIR系列。贴一张小牛老师书里面的插图M3. 内姓”二玲癖后国频窗结构图多速率

3、FIR滤波器有两种说法,半带滤波器(halfband filter)和多相滤波器, 半带其实也是多相的一个特例,区别在于,如果进行2的N次幂的插值,我们通 常用半带,因为乘法数量可以降为原来的1/4,而对于非基2的插值,我们就得 用多相结构了。无论是半带还是多相,其实都是一种对原型滤波器的优化。噢, 原型滤波器,对了,为了设计最终使用的滤波器,我们首先要有一个原型滤波器, 然后根据这个原型滤波器再设计半带或是多相结构的滤波器,详情请自行拜读小牛爷爷的书吧,祖师爷的书最好还是买一本算是交了保护费嘛。此处的仿真过程大致如下,首先,生成一个多音正弦,然后进行补零的插值,然 后把补零插值的信号塞到一个

4、低通滤波器里面,这样就有三个版本的信号,原始 信号,补零插值信号,以及插值滤波之后的信号。注意此仿真的计算过程是概念 上的理论模型,实际干活中不会这么做的,因为进入滤波器的数据里面包含的大 量的0数据,把这种数据拿去做乘法是个非常亏本的事情,所以才会有半带啊, 多相啊这种优化,嗯,不再赘述了,先看图吧,另外,吐槽一下,EDN网站啊, 你是我们码农电工的乐园,尽管杂志是免费送的,网站是免费看到,博客是免费 写的,您就不能支持一下清楚一点的图片么,您瞧我这几张时域频域信号图片寒 碜的,我自己都觉得难受,实在不成您办个募捐,俺们捐点款给您买带宽买磁盘 阵列也成啊。三个版本信号的时域图滤波器频响更Mi

5、M Is原始信号频谱补零插值信号频谱3s_iw济4叫邙燔廉11东。4皿A沛洋渤肄解囹。注密瀚斗、。%/ % FILE: testl.m % Simulation of FIR interpolation %/ close all;clear clc% specify input multi-tone sine component frequencysin freq=1:3*20E3;data_len=2048;% signal data lengthfs=600E3;% sample ratequant_bits=12;% signal quant bitskaiser_beta=8;% be

6、ta of kaiser winn_itp=3;% num of interpolationx max 1x=30;% 1x signal time plot x axis max valuen_coef=32;% number of coefficentsf= 0, 0.2, 0.2, 1;m= 1, 1 , 0 , 0;coeff = fir2(n coef-1, f, m);% draw the filter reponse curve freqz(coeff);x max itp= x max 1x * n itp ;fs itp= fs * n itp;% itp for abv o

7、f interpolation data len itp= data len * n itp ;% generate original signalbits);signal 1x = gen quant multi sin(fs, sin freq, data len, quant% create zero filling interpolation signalsignal itp = zeros(data len itp,1);% write the original signal value into itp signalsignal itp(1:n itp:data len itp-n

8、 itp+1) = signal 1x;data conv = conv(coeff, signal itp);filter_out = data_conv(1:data_len_itp);figure; subplot(3,1,1);stem(signal 1x , MarkerSize, 1.5); xlim(1 x max 1x);tt str = Signal 1x;title(tt_str , fontsize, 14);subplot(3,1,2);stem(signal itp, MarkerSize, 1.5);xlim(1 x max itp);tt str = strcat

9、(Signal Itp , num2str(n itp), x);title(tt_str, fontsize, 14);subplot(3,1,3);stem(filter out, MarkerSize, 1.5);xlim(1 x max itp);tt_str = Filter Out;title(tt_str, fontsize, 14);kaiser win spectrum plot(fs, signal 1x, kaiser beta);ylim(-160,10);% set y-axis rangetitle(signal 1x, Normalized Spectrum, f

10、ontsize, 14);kaiser win spectrum plot(fs itp, signal itp, kaiser beta);ylim(-160,10);% set y-axis rangetitle(Zero Interpolation, Normalized Spectrum, fontsize, 14);kaiser win spectrum plot(fs itp, filter out, kaiser beta);ylim(-160,10);% set y-axis rangetitle(Filter Out, Normalized Spectrum,fontsize

11、, 14);% % CIC compensating filter design using frequency sampling methodclear allclose all% CIC filter parameters %R=4;%Decimation factorM=2;%Differential DelayN=4;%Number of StagesB=17;%Number of bits torepresent fixed point filter coefficientsFs = 80e6;% (High) Sampling frequency inHz (before deci

12、mation)Fc = 4e6;% Passband edge in Hz% fir2.m parameters %L = 30;% Order of filter taps; mustbe an even numberFo = R*Fc/Fs;0Fo=0.5/M;% Normalized Cutoff freq;% Fo should be less than1/(4M) for good performance% Fo = 0.5/M;% use Fo=0.5 if we don,tcare responses outside passband % CIC Compensator Desi

13、gn using fir2.m %p = 2e3;%Granulatirys = 0.25/p;%Stepsizefp = 0:s:Fo;%Passbandfrequencysamplesfs = (Fo+s):s:0.5;%Stopbandfrequencysamplesf = fp fs*2;% Noramlized frequencysamples; 0=f=1;Mp = ones(1,length(fp);% Passband response;Mp(1)=1Mp(2:end) = abs( M*R*sin(pi*fp(2:end)/R)./sin(pi*M*fp(2:end).”N;

14、 % Inverse sincMf = Mp zeros(1,length(fs); f(end) = 1;% Filter length L+1% Floating point% Quantization of filterh = fir2(L,f,Mf);h = h/norm(h);coefficientshz = floor(h*power(2,B);coefficients % Full resolution CIC filter response %hrec = ones(1,R*M);tmph = hrec;for k=1:N-1tmph = conv(hrec, tmph);en

15、d;hcic = tmph;hcic=hcic/norm(hcic);% Total Response %hzp = upsample(hz,R);hp = upsample(h, R);ht = conv(hcic, hp);% Concatenation of CIC andfir2 FIR at high freqency% CIC + Fixed point fir2 at% CIC Freq. Response% CIC Comp. response using% Total response for CIC +% Total response for CIC +hzt = conv

16、(hcic, hzp); high frequency Hcic, wt = freqz(hcic, 1, 4096, Fs);Hciccomp, wt = freqz(hp, 1, 4096, Fs); fir2Ht, wt = freqz(ht, 1, 4096, Fs);floating point fir2Hzt, wt = freqz(hzt, 1, 4096, Fs);fixed point fir2Mcic = 20*log10(abs(Hcic)/max(abs(Hcic); % CIC Freq. Response Mciccomp = 20*log10(abs(Hcicco

17、mp)/max(abs(Hciccomp); % CIC Comp. response using fir2Mt = 20*log10(abs(Ht)/max(abs(Ht);% Total response for CIC +floating point fir2Mzt = 20*log10(abs(Hzt)/max(abs(Hzt); % Total response for CIC + fixed point fir2 figure;plot(wt, Mcic, wt, Mciccomp, wt, Mt,wt, Mzt);legend(CIC,CIC Comp,Total Respons

18、e (Floating Point),TotalResponse (Fixed Point),)ylim(-100 5);title(Frequency Sampling Method);gridxlabel(Frequency Hz);ylabel(Filter Magnitude Response dB);% Save filter coefficients for Altera FIR Compiler % filename =fdcoeffR,num2str(R),N,num2str(N),M,num2str(M),L,num2str(L),.txt;fid = fopen(filename, wt);fprintf(fid, %18.0f n, hz); % fixed point coeff% fprintf(fid, %0.6dn,h); % floating pointfclose(fid)

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 生活休闲 > 在线阅读


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号