资源简介
OFDM图.m
代码片段和文件信息
clear all;
close all;
IFFT_bin_length=1024;
carrier_count=200;
bits_per_symbol=2;
symbols_per_carrier=50;
SNR=10;
baseband_out_length=carrier_count*symbols_per_carrier*bits_per_symbol;%总比特数
carriers=(1:carrier_count)+(floor(IFFT_bin_length/4)-floor(carrier_count/2));
conjugate_carriers=IFFT_bin_length-carriers+2;
%发送端
%产生随即二进制数据:
baseband_out=round(rand(1baseband_out_length));
convert_matrix=reshape(baseband_outbits_per_symbollength(baseband_out)/bits_per_symbol);
for k=1:(length(baseband_out)/bits_per_symbol)
modulo_baseband(k)=0;
for i=1:bits_per_symbol
modulo_baseband(k)=modulo_baseband(k)+convert_matrix(ik)*2^(bits_per_symbol-i);
end
end
%串并转换
carrier_matrix=reshape(modulo_basebandcarrier_countsymbols_per_carrier)‘;
%对每个载波的符号进行差分编码
carrier_matrix=[zeros(1carrier_count);carrier_matrix];
for i=2:(symbols_per_carrier+1)
carrier_matrix(i:)=rem(carrier_matrix(i:)+carrier_matrix(i-1:)2^bits_per_symbol);
end
%把差分符号代码转换成相位
carrier_matrix=carrier_matrix*((2*pi)/(2^bits_per_symbol));
%把相位转换成复数
[XY]=pol2cart(carrier_matrixones(size(carrier_matrix1)size(carrier_matrix2)));
complex_carrier_matrix=complex(XY);
%分配载波到指定的IFFT位置
IFFT_modulation=zeros(symbols_per_carrier+1IFFT_bin_length);
IFFT_modulation(:carriers)=complex_carrier_matrix;
IFFT_modulation(:conjugate_carriers)=conj(complex_carrier_matrix);
%画出频域中的OFDM信号代表
figure(1)
stem(0:IFFT_bin_length-1abs(IFFT_modulation(21:IFFT_bin_length))‘b*-‘)
grid on
axis([0 IFFT_bin_length -0.5 1.5])
ylabel(‘Maginitude‘)
Xlabel(‘IFFT Bin‘)
title(‘OFDM Carrier Frequenxy Magnitude‘)
figure(2)
plot(0:IFFT_bin_length-1(180/pi)*angle(IFFT_modulation(21:IFFT_bin_length))‘go‘)
hold on
stem(carriers-1(180/pi)*angle(IFFT_modulation(2carriers))‘b*-‘)
stem(conjugate_carriers-1(180/pi)*angle(IFFT_modulation(2conjugate_carriers))‘b*-‘)
axis([0 IFFT_bin_length -200 +200])
grid on
ylabel(‘Phase(degrees)‘)
Xlabel(‘IFFT Bin‘)
title(‘OFDM Carrier Phase‘)
%通过IFFT将频域转化为时域信号,得到时域信号
time_wave_matrix=ifft(IFFT_modulation‘);
time_wave_matrix=time_wave_matrix‘;
figure(3)
plot(0:IFFT_bin_length-1time_wave_matrix(2:))
grid on
ylabel(‘Amplitude‘)
xlabel(‘Time‘)
title(‘OFDM Time SignalOne Symbol Period‘)
%画出每个载波对应的时域信号(分离的OFDM信号)3131313131313131
for f=1:carrier_count
temp_bins(1:IFFT_bin_length)=0+0j;
temp_bins(carriers(f))=IFFT_modulation(2carriers(f));
temp_bins(conjugate_carriers(f))=IFFT_modulation(2conjugate_carriers(f));
temp_time=ifft(temp_bins‘);
end
figure(4)
plot(0:IFFT_bin_length-1temp_time)
hold on
grid on
ylabel(‘Amplitude‘)
xlabel(‘Time‘)
title(‘Separated Time Waveforms Carriers‘)
for i=1:symbols_per_carrier+1
windowed_time_wave_matrix(i:)=real(time_wave_matrix(i:)).*hamming(IFFT_bin_length)‘;
windowed_time_wave_matrix(i:)=real(time_wave_matrix(i:));
end
%串并转换
ofdm_modulation=reshape(windowed_time_wave_matrix‘1IFFT_bin_length*(symbols_per_carrier
相关资源
- FxNewton.m
- yalmipmatlab解决UC问题范例1补充.rar
- SAM_SSD.m
- 三个参与主体演化博弈matlab.docx
- LM.m
- 二维粒子群算法的matlab源程序.docx.z
- open_file.m
- ofdm1.m
- pure_pursuit_sim.m
- yucekongzhi.m
- Chineseflag.m
- MATLABR2016bMac破解版.txt
- aloha.m
- 基于NSGAII多目标优化Matlab代码.zip
- matlab仿真.rar
- matlabR2016b.zip
- TDOA算法matlab仿真代码.rar
- MATLABR2008控制系统动态仿真教程_例题
-
燃料电池汽车仿真电路设计SIMUli
n - 倒计时电路.ms14
- MatlabR2019a安装破解教程.zip
- maxfter.m
- case30.m
- MatlabR2019A.7z
- SVPWMconverter.mdl
- zw_MATLAB程序.zip
- Matlab调制库函数fskmod参数及源代码详
- MATLABR2018bWin64Crack.zip
- matlab2009a反复要求激活解决方案——亲
- DANDAOFANGZHEN.m
评论
共有 条评论