OFDM信道估计MATLAB代码

上传人:M****1 文档编号:498564024 上传时间:2023-10-19 格式:DOCX 页数:11 大小:25.90KB
返回 下载 相关 举报
OFDM信道估计MATLAB代码_第1页
第1页 / 共11页
OFDM信道估计MATLAB代码_第2页
第2页 / 共11页
OFDM信道估计MATLAB代码_第3页
第3页 / 共11页
OFDM信道估计MATLAB代码_第4页
第4页 / 共11页
OFDM信道估计MATLAB代码_第5页
第5页 / 共11页
点击查看更多>>
资源描述

《OFDM信道估计MATLAB代码》由会员分享,可在线阅读,更多相关《OFDM信道估计MATLAB代码(11页珍藏版)》请在金锄头文库上搜索。

1、echo off;clear all;close all;fprintf(、n OFDM 仿真n n) ;% % 参数定义% %IFFT_bin_length = 1024;收端的FFT变换长度,R代表接受,T代表发送carrier_count = 200;bits_per_symbol = 2;symbols_per_carrier = 50;cp_length = input(cp length = );d4 = input(d4 = );a4 = input(a4 = );SNR = input(SNR = );% % 初始参数设置完毕% % 关闭回显% 从内存中清除变量和函数% 关闭所

2、有图形 设置显示格式% 发送端的 IFFT 变换长度, 接% 子载波数% 位数 / 符号% 符号数/ 载波% 输入循环前缀长度% 输入最大多径时延扩展% 输入最大多径时延扩展的系数%输入信道信噪比(dB)%baseband_out_length = carrier_count*symbols_per_carrier * bits_per_symbol;%计算发送的二进制序列长度:基带传送长度=载波数X符号数/载波X位数/符号 carriers = (1:carrier_count) + (floor(IFFT_bin_length/4)- floor(carrier_count/2); % 载

3、波(坐标): (1:200) + 256- 100 = 157:356conjugate_carriers = IFFT_bin_length - carriers + 2;%载波变换(坐标): 1024- (157:356) + 2 = 1026- (157:356) = (869:670)% %构造共轭时间一载波矩阵,以便应用所谓的RCC, Reduced Computational Complexity算法, 即 ifft 之后结果为实数% 也可以用 flipdim 函数构造对称共轭矩阵 %一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一% %发送信号% %一

4、一一一一一一一一一一一一一一一一一一一一一一一 % Generate a random binary output signal:%- a row of uniform random numbers (between 0 and 1), rounded to 0 or 1%- this will be the baseband signal which is to be transmitted.%一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一baseband_out = round(rand(1,baseband_out_length);%一一一一一一一一一一一一一一一一一一一

5、一一一一一一一一一一一一一% round:朝最近的整数取整,rand:产生均匀分布的随机数矩阵(1X baseband_out_length 阶)% Convert to modulo N integers where N = 2Abits_per_symbol%- this defines how many states each symbol can represent%- first, make a matrix with each column representing consecutive bits% from the input stream and the number of

6、bits in a column equal to the% number of bits per symbol%- then, for each column, multiply each row value by the power of 2 that% it represents and add all the rows%- for example: input 0 1 1 0 0 0 1 1 1 0%bits_per_symbol = 2%convert_matrix = 0 1 0 1 1% 1 0 0 1 0%modulo_baseband = 1 2 0 3 2%convert_

7、matrix=reshape(baseband_out,bits_per_symbol,length(baseband_out)/bits_per_symbol) ;% RESHAPE Change size.把 baseband_out 变为 M X N 阶的矩阵% RESHAPE(X,M,N) returns the M-by-N matrix whose elements% are taken columnwise from X. An error results if X does% not have M*N elements.%for k = 1:(length(baseband_o

8、ut)/bits_per_symbol)modulo_baseband(k) = 0 ;for i = 1:bits_per_symbolmodulo_baseband(k) = modulo_baseband(k) + convert_matrix(i,k)*2A(bits_per_symbol- i); end end% Serial to Parallel Conversion串并转换%- convert the serial modulo N stream into a matrix where each column% represents a carrier and each ro

9、w represents a symbol%- for example:%serial input stream = a b c d e f g h i j k l m n o p%parallel carrier distribution =%C1/s1=a C2/s1=b C3/s1=c C4/s1=d%C1/s2=e C2/s2=f C3/s2=g C4/s2=h%C1/s3=i C2/s3=j C3/s3=k C4/s3=l%.%.%carrier_matrix = reshape(modulo_baseband, carrier_count, symbols_per_carrier)

10、; %生成时间一载波矩阵(carrier_countXsymbols_per_carrier)% Apply differential coding to each carrier string%- append an arbitrary start symbol (let it be 0, that works for all% values of bits_per_symbol) (note that this is done using a vertical% concatenation x;y of a row of zeros with the carrier matrix, swe

11、et!)%- perform modulo N addition between symbol(n) and symbol(n-1) to get the% coded value of symbol(n)%- for example:%bits_per_symbol = 2 (modulo 4)%symbol stream = 3 2 1 0 2 3%start symbol = 0%coded symbols = 0 + 3 = 3% 3 + 2 = 11 = 1% 1 + 1 = 2% 2 + 0 = 2% 2 + 2 = 10 = 0% 0 + 3 = 3%coded stream =

12、 0 3 1 2 2 0 3% % QDPSK 调制 % %carrier_matrix=zeros(1,carrier_count);carrier_matrix;% 添加一个差分调制的初始相位,为0for i = 2:(symbols_per_carrier + 1)carrier_matrix(i,:) = rem(carrier_matrix(i,:)+carrier_matrix(i-1,:),2Abits_per_symbol); %差 分调制( rem 除后取余)end% % Convert the differential coding into a phase%- each

13、phase represents a different state of the symbol%- for example:%bits_per_symbol = 2 (modulo 4) symbols = 0 3 2 1 phases =0 * 2pi/4 = 0 (0 degrees)3 * 2pi/4 = 3pi/2 (270 degrees)2 * 2pi/4 = pi (180 degrees)1 * 2pi/4 = pi/2 (90 degrees)carrier_matrix% 产生差分相位carrier_matrix(2*pi)/(2Abits_per_symbol);% %

14、 Convert the phase to a complex number%- each symbol is given a magnitude of 1 to go along with its phase% (via the ones(r,c) function)%- it is then converted from polar to cartesian (complex) form%- the result is 2 matrices, X with the real values and Y with the imaginary%- each X column has all the real values for a carrier, and each Y column

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 学术论文 > 其它学术论文

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号