halfband_kaiser.m

来自「基于kaiser窗的四倍内插和两个半带滤波器的级联」· M 代码 · 共 59 行

M
59
字号
clc;
clear all;
fIQ=4.096*1000000;%输入数据速率
DB=80;%阻带衰减
Fpass= 1638400;            % Passband Frequency
x=1;%the data of input
%%%%%%%%%%%%%第一个半带滤波器%%%%%%%%
Fs1 = 2*fIQ;  % Sampling Frequency
x1=[1 0];%2倍内插
N1 =56;  % Order
Beta=7.05;   % Window Parameter

% Create the window vector for the design algorithm.
win1 = kaiser(N1+1, Beta);

% Calculate the coefficients using the FIR1 function.
h1  = firhalfband(N1, win1);
out1=conv(h1',x1);%%卷积后数据
[n1,m1]=size(out1);
H1=fft(out1);
max1=max(abs(H1));
H1_relative=abs(H1)/max1;
%H=-20*log10(abs(fft(h)));

figure(1)
df1=Fs1/n1;
i=0:(n1-1);
subplot(211);
plot(i*df1/fIQ,20*log10(H1_relative));
grid on
%%%%%%%%%%%第二个半带滤波器%%%%%%%%%%%%%
Fs2 = 4*fIQ;  % Sampling Frequency
out1_insert=zeros(1,2*n1);
for i=1:2*n1
    if mod(i,2)==1
        out1_insert(i)=out1((i+1)/2);
    end 
end


N2    =18;  % Order

% Create the window vector for the design algorithm.
win2 = kaiser(N2+1, Beta);

% Calculate the coefficients using the FIR1 function.
h2 = firhalfband(N2, win2);
out2=conv(h2,out1_insert);
[n2,m2]=size(out2');
H2=fft(out2);
max2=max(abs(H2));
H2_relative=H2/max2;
%H=-20*log10(abs(fft(h)));
df2=Fs2/n2;
i=0:(n2-1);
subplot(212);
plot(i*df2/fIQ,20*log10(abs(H2_relative)));
grid on

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?