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

📄 qam.asv

📁 16QAM的MATLAB调制解调仿真
💻 ASV
字号:

function [y,fs,fb,fc]=qam(x,Kbase,fs,fb,fc);
%
%   Usage:[y, fs, fb, fc]=qam(x,kbase,fs,fb,fc);BBI2000
if nargin<5,fc=2;end;
if nargin<4;fb=1;end;
if nargin<3,fs=32;end;
if nargin<2;Kbase=2;end;
if nargin<1
   x=[1 1 1 1 1 1 1 0 1 1 0 1 1 1 0 0];
   x=[x 1 0 1 1 1 0 1 0 1 0 0 1 1 0 0 0];
   x=[x 0 0 1 1 0 0 1 0 0 0 0 1 0 0 0 0];
   x=[x 0 1 1 1 0 1 1 0 0 1 0 1 0 1 0 0];
end;
T=length(x)/fb;   
m=fs/fb;  
nn=length(x);
dt=1/fs;
t=0: dt :T-dt;
Kbase=rem(Kbase,2);
Kbase+Kbase+(Kbase==0)*2;
tstr='QAM';
I=x(1: 2: nn-1);
[I,In]=two2four(I,4*m);
Q=x(2: 2: nn);
[Q,Qn]=two2four(Q,4*m);
if Kbase==2;
   I=bshape(I,fs,fb/4);
   Q=bshape(Q,fs,fb/4);
end;
y=I.*cos(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:');
   if Kbase==2;
      tstr=[tstr ' with the RC filter'];
   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(' Specturm'); xlabel(' f/fb'); zoom xon;
   subplot(224);constel(y1,fs,fb,fc);xlabel(' Constellsstion');
   set (gcf,' num','off',' name',[tstr ',' blanks(10) 'BBI 2000']);
end;
function [y,yn]=two2four(x,m);
%
% BBI 2000
if nargin<2;m=32;end;
if nargin<1;x=[1 0 1 0 1 0 0 1 1 1 0 1 0 0 0 0 1 1]
T=[0 1 ;3 2 ];n=length(x);ii=1;
for i=1:2:n-1;
  xi=x(i:i+1)+1;yn(ii)=T(xi(1),x(2));ii=ii+1;
end;
yn=yn-1.5;y=yn;
for i=1:m-1 ; y=[y;yn] ;end ; y=y(:)';
%
if nargout<1;
subplot(211);plot(pulse(x));v=axis;axis([v (1:2) -.5 1.5]);
subplot(212);plot(y);v=axis;axis([v (1:2) -2 2]);
end;

⌨️ 快捷键说明

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