%%*************************************************************************
%%此程序用来仿真OFDM系统在AWGN信道中的误码特性
%%Function information:
%%
%%-------------------------------------------------------------------------
%% Created by Wei Zhao 2003-04-17 (Version 1.0)
%%-------------------------------------------------------------------------
%% Recreated by Kunji Wang
%%*************************************************************************
%%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%% MAIN PROGRAM
%%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
clear;
clc;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% System Parameters
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
NumOfSubcarrier = 64;
LengthOfGI = 16; % the subcarriers GI(guard interval)contains
modulation_mode = 4;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Simulation Parameters
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
NumOfSymbolPerFrame=5;
NumOfFrames=100;
SNR_in_dB=[0:4:30];
fs=10000;
fd=100;
Rb=fs;
Ts=1/Rb;
dt=Ts;
n_delay=3;
t_delay=[0,100,200];
p_delay=[0.0,-2.0,-6.0];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Simulation Starting!!!
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tic;
for counter=1:length(SNR_in_dB)
P=1; % energy per symbol
snr=10^(SNR_in_dB(counter)/10); % signal to noise ratio
sgma=sqrt(P/(snr)); % noise variance
%Clear the all the counters
NumOfErrorBit = 0;
SampleIndex=0;
for Frame_counter = 1:NumOfFrames
%--------------------------------------------------------------------------------------------
% Tx
%--------------------------------------------------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Source Bit Sequence
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Source_Bits=randint(1,2*NumOfSubcarrier*NumOfSymbolPerFrame);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% QPSK Modulation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Modulated_Sequence=modulation(Source_Bits,modulation_mode);
R_Modulated_Sequence=reshape(Modulated_Sequence,NumOfSubcarrier,NumOfSymbolPerFrame);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% IFFT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
IFFT_Out_Data(:,:) =sqrt(NumOfSubcarrier)* ifft (R_Modulated_Sequence);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% adding guard interval for DATA
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GI_Added_Frame(1:LengthOfGI,:) = IFFT_Out_Data((NumOfSubcarrier-LengthOfGI+1):NumOfSubcarrier,:);
GI_Added_Frame((LengthOfGI+1):(NumOfSubcarrier+LengthOfGI),:) = IFFT_Out_Data(1:NumOfSubcarrier,:);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% P -> S
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Serial_Signal = reshape(GI_Added_Frame,1,NumOfSymbolPerFrame*(NumOfSubcarrier+LengthOfGI));
%%%------------------------------------------------------------------------------------------------------------
%% CHANNEL
%%%------------------------------------------------------------------------------------------------------------
%--------------------------------------------------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% AWGN channel
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
in=Serial_Signal;
[out]=channel(in,fs,fd,n_delay,t_delay,p_delay);
Serial_Signal_Ray=Serial_Signal*out;
for i=1:NumOfSymbolPerFrame*(NumOfSubcarrier+LengthOfGI)
[n_I n_Q]=gngauss(sgma);
noise(i)=n_I+j*n_Q;
end
Noised_Transmited_Signal=Serial_Signal_Ray+noise(i);
%--------------------------------------------------------------------------------------------
% Rx
%--------------------------------------------------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Remove the GI
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for jj=1:NumOfSymbolPerFrame
for ii=1:NumOfSubcarrier
GI_Removed_Rx_Signal(ii+(jj-1)*NumOfSubcarrier)=Noised_Transmited_Signal(LengthOfGI*jj+ii+(jj-1)*NumOfSubcarrier);
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% S -> P
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Parallel_Rx_Signal = reshape(GI_Removed_Rx_Signal,NumOfSubcarrier,NumOfSymbolPerFrame);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% FFT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Freq_Rx_Signal = fft(Parallel_Rx_Signal)/sqrt(NumOfSubcarrier);
Demod_In_Data(1:NumOfSubcarrier,1:NumOfSymbolPerFrame) = Freq_Rx_Signal(1:NumOfSubcarrier,1:NumOfSymbolPerFrame);
FFT_Out = conj(Demod_In_Data(:,1:NumOfSymbolPerFrame)');
Serial_Output = reshape(Demod_In_Data,1,NumOfSubcarrier*NumOfSymbolPerFrame);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Demodulation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Demod_Sequence= demodulation(Serial_Output,modulation_mode);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Calculate the BER
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for jj = 1:(length(Source_Bits))
if Demod_Sequence(jj) ~= Source_Bits(jj)
NumOfErrorBit = NumOfErrorBit + 1;
end
end
end
BER(counter) = NumOfErrorBit/(NumOfFrames*NumOfSubcarrier*2*NumOfSymbolPerFrame);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Simulation Completed
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
elapse=toc
clock_time = clock;
present = fix(clock_time)
%---------------------------------------------%
%% Draw BER figure
%---------------------------------------------%
h=figure;
semilogy(SNR_in_dB,BER,'r*-');
xlabel('SNR(dB)');
ylabel('BER(bit error rate)');
title( 'BER performance of OFDM in AWGN Channel');
grid on ;
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
时变多径信道的matlab仿真(通过输入多普勒频移,时延变量等参数) Matlab simulation of time-varying multipath channel (by inputting Doppler frequency shift, delay variable and other parameters)
资源推荐
资源详情
资源评论
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![m](https://img-home.csdnimg.cn/images/20210720083646.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 14 条
- 1
![avatar](https://profile-avatar.csdnimg.cn/default.jpg!1)
![avatar-vip](https://csdnimg.cn/release/downloadcmsfe/public/img/user-vip.1c89f3c5.png)
wouderw
- 粉丝: 302
- 资源: 2961
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)
- 1
- 2
- 3
前往页