⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qpsk.m

📁 此程序实现了用matlab仿真qpsk的调制过程
💻 M
字号:
function[y,Kmod,fs,fb,fc]=qpsk(x,Kmod,Kbase,fs,fb,fc);
%
%
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;
    Kmode=1;
end;
if nargin<1;
    x=[0 0 0 1 1 1 1 0];
end;
%
T=length(x)/fb;
m=fs/fb;
nn=length(x);
dt=1/fs;
t=0:dt:T-dt;
Kmod=rem(Kmode,2);
Kmod=Kmod+(Kmode==0)*2;
Kbase=rem(Kbase,2);
Kbase=Kbase+(Kbase==0)*2;
if Kmod==1;
    x1=x*2-1;
    tstr='QPSK';
elseif Kmod==2;
    x1=dqpskcd(x);
    x1=x1*2-1;
    tstr=['QDPSK'];
end;
I=x1(1:2:nn-1);
Q=x1(2:2:nn);

if Kbase==2;
    I=bshape(I,fs,fb/2);
    Q=bshape(Q,fs,fb/2);
end;
y=I.*cos(2*pi*fc*t)-Q.*sin(2*pi*fc*t);
y1=y;
n=length(y);
%--------------------------------------------------------------------
if nargout<1;
    subplot(211);
    plot(t,y,t,I,t,Q,[0 T],[0 0],'b:');
end;
title('signal');
n=length(y);
y=fft(y)/n;
y=abs(y(1:fix(n/2)))*2;
I=find(y<1e-04);
y(I)=1e-04;
y=20*log10(y);
f1=m/n;
f=0:f1:(length(y)-1)*f1;
subplot(223);
plot(f,y,'r');
grid on;
title('Spectrum');
xlabel('f/fb');
zoom xon;
subplot(224);
constel(y1,fs,fb,fc);
xlabel('Constellation');

    

⌨️ 快捷键说明

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