📄 mpfilter.m
字号:
%this function is to decimate signal by multiphase
%wp is passband cut-off frequency of prototype lowpass filter
%ws is stopband starting frequency of prototype lowpass filter
%rp is the ripple of passband of prototype lowpass filter
%rs is the ripple of stopband of prototype lowpass filter
%MM is the decimation factor
%tn2 is the total length of pulse width that cut by 1/fs
%I ,Q are the signal decimated by multiphase filter
function [I,Q]=mpfilternull(wp,ws,rp,rs,si,sq,MM,tn2)
delta1=(10^(rp/20)-1)/(10^(rp/20)+1);
delta2=(1+delta1)*(10^(-rs/20));
weights=[delta2/delta1 1]; %Weights is half the length of f and m
deltaf=(ws-wp)/(2*pi);
M=ceil((-20*log10(sqrt(delta1*delta1))-13)/(14.6*deltaf)+1);
M=M+2;
f=[0 wp/pi ws/pi 1];
m=[1 1 0 0];
h=remez(M-1,f,m,weights);h
[db,mag,pha,grd,w]=freqz_m(h,[1]);
hh=length(h);
count1=hh/MM;
count2=tn2/MM;
I=zeros(1,100);Q=zeros(1,100);
for i1=1:MM
i2=1:count1;
A(i1,i2)=h((i2-1)*MM+i1);
A(i1,i2)
end
for i1=1:MM
%for i2=1:count1
% A(i1,i2)=h((i2-1)*MM+i1);
%end
% i3=1:count1;
i4=1:count2;
%AI(i1,i4)=filter(A(i1,i3),[1],si(MM*(i4-1)+(MM+1-i1)));
AI(i1,i4)=filter(A((MM+1-i1),i2),[1],si(MM*(i4-1)+i1));
I=I+AI(i1,i4);
%AQ(i1,i4)=filter(A(i1,i3),[1],sq(MM*(i4-1)+(MM+1-i1)));
AQ(i1,i4)=filter(A((MM+1-i1),i2),[1],sq(MM*(i4-1)+i1));
Q=Q+AQ(i1,i4);
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -