cooperate with Liu Lei用IDFT实现OFDM的代码如下:
N=32;
x=randint(1,N,[0 3]);
x1=qammod(x,4);
f=1:N;
t=0:0.001:1-0.001;
w=2*pi*f.'*t;
% w1=2*pi*(f+0.2).'*t;
y1=x1*exp(j*w);%子载波调制
x2=ifft(x1,N); %ifft
figure(1);
plot(t,abs(y1));
hold on;
stem(0:1/N:1-1/N,abs(x2)*N,'-r');
legend('模拟调制实现','IDFT实现');
title('OFDM的模拟调制实现与IDFT实现');
hold off;
用IDFT实现UF-OFDM的代码如下:
N=32;
x=randint(1,N,[0 3]);
x1=qammod(x,4);
f=1:N;
t=0:0.001:1-0.001;
w=2*pi*f.'*t;
y1=x1*exp(j*w);%子载波调制
y1=fft(y1);
fpass = 0;
fstop = 10;
[f1,y1] = IdealFilter(length(t),10,fpass,fstop,y1); % 进行理想带通滤波
y1=ifft(y1);
x2=ifft(x1,N); %ifft
figure(1);
plot(t,abs(y1));
hold on;
stem(0:1/N:1-1/N,abs(x2)*N,'-r');
legend('模拟调制实现','IDFT实现');
title('UF-OFDM的模拟调制实现与IDFT实现');
hold off;