echo off;clear all;close all;clc; fprintf( 'OFDM 仿真\n') ; tic % --------------------------------------------- % % 参数定义 % % --------------------------------------------- % % Initialize the parameters NumLoop = 1000; NumSubc = 128; NumCP = 8; SyncDelay = 0; % 子载波数 128 % 位数/ 符号 2 % 符号数/ 载波 1000 % 训练符号数 0 % 循环前缀长度 8 (1/16)*T % 调制方式 4-QAM % 多径信道数 3 % IFFT Size 128 % 信道最大时延 2 % --------------------------------------------- % % QAM MODULATION % % --------------------------------------------- % % Generate the random binary stream for transmit test BitsTx = floor(rand(1,NumLoop*NumSubc)*2); % Modulate (Generates QAM symbols) % input: BitsTx(1,NumLoop*NumSubc); output: SymQAM(NumLoop,NumSubc/2) SymQAMtmp = reshape(BitsTx,2,NumLoop*NumSubc/2).'; SymQAMtmptmp = bi2de(SymQAMtmp,2,'left-msb'); %-------------------------------------------------------------------- % 函数说明: % bin2dec(binarystr) interprets the binary string binarystr and returns the % equivalent decimal number. % bi2de 是把列向量的每一个元素都由 2 进制变为 10 进制 % D = BI2DE(...,MSBFLAG) uses MSBFLAG to determine the input orientation. % MSBFLAG has two possible values, 'right-msb' and 'left-msb'. Giving a % 'right-msb' MSBFLAG does not change the function's default behavior. % Giving a 'left-msb' MSBFLAG flips the input orientation such that the % MSB is on the left. % % % D = BI2DE(...,P) converts a base P vector to a decimal value. % % Examples: % % >> B = [0 0 1 1; 1 0 1 0]; % % >> T = [0 1 1; 2 1 0]; % % >> D = bi2de(B) >> D = bi2de(B,'left-msb') >> D = bi2de(T,3) % % D = D = D = % % 12 3 12 % % 5 10 5 %-------------------------------------------------------------------- % QAM modulation % 00->-1-i,01->-1+i,1...