A list,

Ii. Source code

Clear All close all %% Parameter setting N_FFT=256; % FFT points fs =4*10^6; % baseband sampling frequency4MHz
fsub=15.625*10^3; % subcarrier frequency interval15.625Short training symbol frequency domain representation F_Shortpreamble(1:256) = [0.0.0.0.- 1- 1j,0.0.0.1- 1j,0.0.0.1+1j,0.0.0.- 1- 1j,0.0.0.- 1+1j,0.0.0.1- 1j,0.0.0.1+1j,0.0.0.- 1+1j,0.0.0.1- 1j,0.0.0.- 1- 1j,0.0.0.1+1j,0.0.0.- 1+1j,0.0.0.- 1- 1j,0.0.0.1+1j,0.0.0.1- 1j,0.0.0.- 1- 1j,0.0.0.1- 1j,0.0.0.1+1j,0.0.0.- 1- 1j,0.0.0.- 1+1j,0.0.0.- 1+1j,0.0.0.- 1- 1j,0.0.0.1- 1j,0.0.0.- 1+1j,0.0.0.1+1j,0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1+1j,0.0.0.1+1j,0.0.0.1+1j,0.0.0.1- 1j,0.0.0.- 1+1j,0.0.0.1+1j,0.0.0.1+1j,0.0.0.1+1j,0.0.0.1- 1j,0.0.0.- 1+1j,0.0.0.1+1j,0.0.0.1+1j,0.0.0.1+1j,0.0.0.1- 1j,0.0.0.- 1+1j,0.0.0.1- 1j,0.0.0.1- 1j,0.0.0.1- 1j,0.0.0.- 1- 1j,0.0.0.1+1j,0.0.0.- 1+1j,0.0.0.- 1+1j,0.0.0.- 1+1j,0.0.0.1+1j,0.0.0.- 1- 1j,0.0.0]; % short training symbol time domain representation T_Shortpreamble(1:256)=ifft(F_Shortpreamble); % long training symbol frequency domain representation F_Longpreamble(1:256) = [0.- 1-j, 1+j, - 1+j, - 1+j, - 1-j, 1+j, 1+j, 1+j, - 1-j, 1+j, 1-j, 1-j, 1-j, - 1+j,- 1+j,- 1+j, - 1+j, 1-j, - 1-j, - 1-j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-j, 1-j,- 1+j, 1-j, 1-j, - 1+j, 1-j, - 1+j,- 1+j, - 1-j, 1+j]; % long training symbol frequency domain representation T_Longpreamble(1:256)=ifft(F_Longpreamble); %% convolution encoding %[133 171] the convolution code is actually the convolution code (2.1.7Signal = randi([0 1].1.1920); % encoder input48Bit trellis = poly2trellis (7[133 171]); % The former is the constraint length N of the convolution code, while the latter is an M * N matrix based on the connection between input and output, where M is the number of input signals and N is the number of output signals. con_code=convenc(signal,trellis);figure
 subplot(2.1.1)
 stairs(signal(1:50));
 ylabel('幅度');
 title('Data before convolution encoding');
 subplot(2.1.2)
 stairs(con_code(1:100));
 title('Convolved encoded data');
 ylabel('幅度'); %% QPSK mapping bits_per_symbol=2; % Number of bits per sign,QPSK modulation QPSK_code_bin= 01920,bits_per_symbol); %1920Is the length of the data1*3840The transformation of the matrix of omega is zero1920*2The matrix of, before1920Is the first column, after1920Bit second column QPSK_code_dec=2*QPSK_code_bin(:,1)+QPSK_code_bin(:,2);
txSig = pskmod(QPSK_code_dec,4,pi/4); Scatterplot (txSig)% Constellation %% Inverse Fourier transform temp= Zeros (1.256);
temp([13 38 63 88 168 193 218 243]) =1; % interpolation1
for m=1:10
    temp_data(m,2:12)=txSig((m- 1) *192+1:(m- 1) *192+11);
    temp_data(m,14:37)=txSig((m- 1) *192+12:(m- 1) *192+35);
    temp_data(m,39:62)=txSig((m- 1) *192+36:(m- 1) *192+59);
    temp_data(m,64:87)=txSig((m- 1) *192+60:(m- 1) *192+83);
    temp_data(m,89:100)=txSig((m- 1) *192+84:(m- 1) *192+95);
    temp_data(m,156:167)=txSig((m- 1) *192+96:(m- 1) *192+107);
    temp_data(m,169:192)=txSig((m- 1) *192+108:(m- 1) *192+131);
    temp_data(m,194:217)=txSig((m- 1) *192+132:(m- 1) *192+155);
    temp_data(m,219:242)=txSig((m- 1) *192+156:(m- 1) *192+179);
    temp_data(m,244:256)=txSig((m- 1) *192+180:(m- 1) *192+192);
    temp_data(m,:)=temp+temp_data(m,:);
    f_data(m,:)=ifft(temp_data(m,:))*16;
    figure
    plot(0:1/ (255*4*10^6) :1/ (4*10^6),abs(f_data(m,:))'); title('The time domain waveform'); xlabel('t/s'); ylabel('amplitude'); End % % and CP data_cp = [f_data (:, 193: the end), f_data (:, :)]; % data add CP Shortpreamble_cp=[T_Shortpreamble(:,193:end),T_Shortpreamble(:,:)]; % short training set + CP Longpreamble_cp=[T_Longpreamble(:,193:end),T_Longpreamble(:,:)]; OFDM_frame=[Shortpreamble_cp.*32,Longpreamble_cp, 0 (0[],1). ']; %% up frequency fc=4*4000000; % takes carrier FC as baseband bandwidth4Set the sampling frequency to be four times the carrier frequency and output will be performed within each baseband time slot16*320A symbol; t=0:80*10^ (- 6)/(320*16) :80*10^ (- 6) /320*length(OFDM_frame)- 80.*10^ (- 6)/(320*16);
 carrier=exp(j*(2*pi*(fc+25)*t));
 sam=kron(OFDM_frame,ones(1.16)); frame_up=real(sam.*carrier); % up-conversionfigure
 subplot(2.1.1)
 plot(t,abs(frame_up));
 xlabel('t/s');
 ylabel('幅度');
 title('Time domain waveform after up-conversion');
 subplot(2.1.2)
 plot(abs(OFDM_frame));
 title('OFDM Frame Time domain waveform ');
 xlabel('t/s');
 ylabel('幅度');
for SNR=2:100
% SNR=6; RxSig = AWGN (frame_UP,SNR/2); % white Gaussian noise channel %rxSig= frame_UP; % figure % plot(rxSig,'r');
% hold on 
% plot(frame_up,'b') %% down conversion carrier_cos=cos(2*pi*fc*t);
carrier_sin=-sin(2*pi*fc*t); 0 0 0 0 0 0 0 0 016,length(carrier_cos)/16);
carrier_sin_reshape=reshape(carrier_sin,16,length(carrier_sin)/16);

frame_up_reshape=reshape(rxSig,16,length(rxSig)/16);
rece_cos=frame_up_reshape'*carrier_cos_reshape/16*2;
rece_sin=frame_up_reshape'*carrier_sin_reshape/16*2;
for ii=1:length(OFDM_frame)
    rece_real(ii)=rece_cos(ii,ii);
    rece_im(ii)=rece_sin(ii,ii);
end
rece_down=rece_real+1i*rece_im; %% AGC automatic gain control y= AGC (rece_down,20,length(rece_down));
% figure
%  subplot(2.1.1)
%  plot(abs(rece_down));
%  ylabel('幅度');
%  title('Down conversion signal');
%  subplot(2.1.2)
%  plot(abs(y));
%  title('Signal after automatic gain control');
%  ylabel('幅度'); FrameStart=frame_detection(y,340);
frame=[y(FrameStart+1:end),zeros(1.256)]; %% to CP and FFT to pilotfor i=1:10
    data_rx(i,:)=frame(65+i*320:(i+1) *320);
%     data_rx(i,:)=y(65+(i+1) *320:(i+2) *320);
    data_r(i,:)=fft(data_rx(i,:))/sqrt(N_FFT);
    data(i,1:11)=data_r(i,2:12);
    data(i,12:35)=data_r(i,14:37);
    data(i,36:59)= data_r(i,39:62);
    data(i,60:83)=data_r(i,64:87);
    data(i,84:95)=data_r(i,89:100);
    data(i,96:107)=data_r(i,156:167);
    data(i,108:131)=data_r(i,169:192);
    data(i,132:155)=data_r(i,194:217);
    data(i,156:179)=data_r(i,219:242);
    data(i,180:192)=data_r(i,244:256);
end
Copy the code

3. Operation results

















Fourth, note

2014a