📄 qpskdet.asv
字号:
function[xn,x]=qpskdet(y,Kmod,fs,fb,fc);
%
%Usage;[xn,x]=qpskdet(y,Kmod,fs,fb,fc); BBI2000
% Detection of QPSK and QDPSK
if nargin<6;fc=2; end;
if nargin<5;fb=1; end;
if nargin<4;fs=32;end;
if nargin<3;Kbase=2; end;
if nargin<2;Kmod=1;end;
if nargin<1;y=qpsk([0 0 0 1 1 1 1 0]) ;end;
Kmod=rem(Kmod,2); Kmod=Kmod+(Kmod==0)*2;
dt=1/fs;t=0:dt:(length(y)-1)*dt;
I=y.*cos(2*pi*fc*t);Q=-y.*sin(2*pi*fc*t);
[b,a]=butter(2,2*fb/fs);
I=filtfilt(b,a,I); Q=filtfilt(b,a,Q);
m=2*fs/fb;N=length(y)/m;n=(.75:1:N)*m;
In=(sign(I(n))+1)/2;Qn=(sign(Q(n))+1)/2;
xn=[In;Qn];xn=xn(:);xn=xn';x=[I;Q];
if Kmod==1;
tstr='QPSK,';
elseif Kmod==2;
xn=dqpskcd(xn,2);tstr='QDPSK,';
end;
%--------------------------------------------------------------------------
if nargout<1;
c='bbbbbbbbrrrrrrrr';
subplot(211);plot(t,y);title('Input');
subplot(212);plot(t,x);set(gca,'grid','on');v=axis;
for i=1:2*N;
ci=rem(i,16);ci=ci+(ci==0)*16;ci=c(ci);
text((2*i-1)*m*dt/4,v(4)*.8,int2str(xn(i)),'color',ci);
end;title('Output');
set(gcf,'num',
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -