%采用10个子载波,1000,1100,1200,...,1900。T=0.01s,传了20bit。数据率是2000bit/s。Rs=2000/10/2=100symbol/s。delta f=1/Tsymbol。
%在matlab里用离散的模拟连续的,解析度fs为1000000。
%问题:在数字调制实现中由ifft得到了ofdm信号的复包络的采样后,书上说由DA得到复包络信号,在matlab中如何实现,或者由基带复包络得到带通信号。
%用10个子载波调制的方法
% a=[ 1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 1 0 0 1 0 ];
a=[ 1 -1 1 1 -1 1 -1 -1 1 -1 1 1 -1 1 1 1 -1 -1 1 -1 ];fs=1000000;
T=0.01;
t=0:1/fs:T-1/fs;
f0=1000;f1=1100;f2=1200;f3=1300;f4=1400;f5=1500;f6=1600;f7=1700;f8=1800;f9=1900;
f=[cos(2*pi*f0*t);-sin(2*pi*f0*t); cos(2*pi*f1*t);-sin(2*pi*f1*t); cos(2*pi*f2*t);-sin(2*pi*f2*t); cos(2*pi*f3*t);-sin(2*pi*f3*t); cos(2*pi*f4*t);-sin(2*pi*f4*t); cos(2*pi*f5*t);-sin(2*pi*f5*t); cos(2*pi*f6*t);-sin(2*pi*f6*t); cos(2*pi*f7*t);-sin(2*pi*f7*t); cos(2*pi*f8*t);-sin(2*pi*f8*t); cos(2*pi*f9*t);-sin(2*pi*f9*t);];
A=repmat(a',1,fs*T);
S1=A.*f;
S2=sum(S1);
figure;plot(t,S2,'.-r');
%用数字ifft实现
clear
a=[ 1 -1 1 1 -1 1 -1 -1 1 -1 1 1 -1 1 1 1 -1 -1 1 -1 ];
a1=zeros(2,10);
a1(:)=a;
a2=a1(1,:)+j*a1(2,:);
a3=ifft(a2);
ac=real(a3);
as=imag(a3);
fs=1000000;
T=0.01;
t=0:1/fs:T-1/fs;
ac1=repmat(ac,1000,1);
ac2=ac1(:)';
as1=repmat(as,1000,1);
as2=as1(:)';
S=ac2.*cos(2*pi*1000*t)-as2.*sin(2*pi*1000*t);
figure;plot(t,S,'.-r');