% Program 4-2
% ofdm_fading.m
%
% Simulation program to realize OFDM transmission system
% (under one path fading)
%
% programmed by T.Yamamura and H.Harada
%
function [ber,per]=ofdm_fading(ebn0dB0)
%********************** preparation part ***************************
para=128; % Number of parallel channel to transmit (points)
fftlen=128; % FFT length
noc=128; % Number of carrier
nd=10; % Number of information OFDM symbol for one loop
ml=1; % Modulation level : QPSK
sr=250000; % Symbol rate
br=sr.*ml; % Bit rate per carrier
gilen=32; % Length of guard interval (points)
%ebn0=10; % Eb/N0
%******************* Fading initialization ********************
% If you use fading function "sefade", you can initialize all of parameters.
% Otherwise you can comment out the following initialization.
% The detailed explanation of all of valiables are mentioned in Program 2-8.
% Time resolution
tstp=1/sr/(fftlen+gilen);
% Arrival time for each multipath normalized by tstp
% If you would like to simulate under one path fading model, you have only to set
% direct wave.
itau = [0];
% Mean power for each multipath normalized by direct wave.
% If you would like to simulate under one path fading model, you have only to set
% direct wave.
dlvl = [0];
% Number of waves to generate fading for each multipath.
% In normal case, more than six waves are needed to generate Rayleigh fading
n0=[6];
% Initial Phase of delayed wave
% In this simulation four-path Rayleigh fading are considered.
th1=[0.0];
% Number of fading counter to skip
itnd0=nd*(fftlen+gilen)*10;
% Initial value of fading counter
% In this simulation one-path Rayleigh fading are considered.
% Therefore one fading counter are needed.
itnd1=[1000];
% Number of directwave + Number of delayed wave
% In this simulation one-path Rayleigh fading are considered
now1=1;
% Maximum Doppler frequency [Hz]
% You can insert your favorite value
fd=320;
% You can decide two mode to simulate fading by changing the variable flat
% flat : flat fading or not
% (1->flat (only amplitude is fluctuated),0->nomal(phase and amplitude are fluctutated)
flat =1;
%************************** main loop part **************************
nloop=500; % Number of simulation loops
noe = 0; % Number of error data
nod = 0; % Number of transmitted data
eop=0; % Number of error packet
nop=0; % Number of transmitted packet
for iii=1:nloop
while(1)
%************************** transmitter *********************************
%************************** Data generation ****************************
seldata=rand(1,para*nd*ml)>0.5; % rand : built in function
%****************** Serial to parallel conversion ***********************
paradata=reshape(seldata,para,nd*ml); % reshape : built in function
%************************** QPSK modulation *****************************
paradata1=paradata.*2-1;
kmod=1/sqrt(2); % sqrt : built in function
ich1=paradata1.*kmod;
%******************* IFFT ************************
x=ich1;
y=ifft(x); % ifft : built in function
ich2=real(y); % real : built in function
qch2=imag(y); % imag : built in function
%********* Gurad interval insertion **********
[ich3,qch3]= giins(ich2,qch2,fftlen,gilen,nd);
fftlen2=fftlen+gilen;
%********* Attenuation Calculation *********
spow=sum(ich3.^2+qch3.^2)/nd./para; % sum : built in function
attn=0.5*spow*sr/br*10.^(-ebn0dB0/10);
attn=sqrt(attn);
%********************** Fading channel **********************
% Generated data are fed into a fading simulator
[ifade,qfade]=sefade(ich3,qch3,itau,dlvl,th1,n0,itnd1,now1,length(ich3),tstp,fd,flat);
% Updata fading counter
itnd1 = itnd1+ itnd0;
%*************************** Receiver *****************************
%***************** AWGN addition *********
[ich4,qch4]=comb(ifade,qfade,attn);
%****************** Guard interval removal *********
[ich5,qch5]= girem(ich4,qch4,fftlen2,gilen,nd);
%****************** FFT ******************
rx=ich5+qch5.*i;
ry=fft(rx); % fft : built in function
ich6=real(ry); % real : built in function
%***************** demoduration *******************
ich7=ich6./kmod;
[demodata] = ich7 > 0;
%************** Parallel to serial conversion *****************
demodata1=reshape(demodata,1,para*nd*ml);
%************************** Bit Error Rate (BER) ****************************
% instantaneous number of error and data
noe2=sum(abs(demodata1-seldata)); % sum : built in function
nod2=length(seldata); % length : built in function
% cumulative the number of error and data in noe and nod
noe=noe+noe2;
nod=nod+nod2;
% calculating PER
if noe2~=0
eop=eop+1;
else
eop=eop;
end
eop;
nop=nop+1;
if noe > 500
break; % while(1)
end
end
end
%********************** Output result ***************************
per=eop/nop;
ber=noe/nod;
fprintf('%f\t%e\t%e\t%d\t\n',ebn0dB0,ber,per,noe);
fid = fopen('BERofdmfad.dat','a');
fprintf(fid,'%f\t%e\t%e\t%d\t\n',ebn0dB0,ber,per,noe);
fclose(fid);
%******************** end of file ***************************
没有合适的资源?快使用搜索试试~ 我知道了~
【误码率仿真】基于matlab OFDM-BPSK调制误码率仿真【含Matlab源码 3840期】.zip
共14个文件
m:11个
dat:1个
jpg:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 191 浏览量
2024-01-21
23:27:48
上传
评论
收藏 40KB ZIP 举报
温馨提示
CSDN海神之光上传的代码均可运行,亲测可用,直接替换数据即可,适合小白; 1、代码压缩包内容 主函数:main.m; 调用函数:其他m文件;无需运行 运行结果效果图; 2、代码运行版本 Matlab 2019b;若运行有误,根据提示修改;若不会,私信博主; 3、运行操作步骤 步骤一:将所有文件放到Matlab的当前文件夹中; 步骤二:双击打开main.m文件; 步骤三:点击运行,等程序运行完得到结果; 4、仿真咨询 如需其他服务,可私信博主或扫描博客文章底部QQ名片; 4.1 博客或资源的完整代码提供 4.2 期刊或参考文献复现 4.3 Matlab程序定制 4.4 科研合作 功率谱估计: 故障诊断分析: 雷达通信:雷达LFM、MIMO、成像、定位、干扰、检测、信号分析、脉冲压缩 滤波估计:SOC估计 目标定位:WSN定位、滤波跟踪、目标定位 生物电信号:肌电信号EMG、脑电信号EEG、心电信号ECG 通信系统:DOA估计、编码译码、变分模态分解、管道泄漏、滤波器、数字信号处理+传输+分析+去噪、数字信号调制、误码率、信号估计、DTMF、信号检测识别融合、LEACH协议、信号检测、水声通信
资源推荐
资源详情
资源评论
收起资源包目录
【误码率仿真】基于matlab OFDM-BPSK调制误码率仿真【含Matlab源码 3840期】.zip (14个子文件)
【误码率仿真】基于matlab OFDM-BPSK调制误码率仿真【含Matlab源码 3840期】
girem.m 777B
crdemapping.m 706B
BERofdmfad.dat 3KB
crmapping.m 739B
ofdm_main.m 615B
giins.m 846B
运行结果.jpg 32KB
delay.m 741B
sefade.m 2KB
ofdm_main.asv 560B
ofdm_fading.m 5KB
fade.m 2KB
comb.m 658B
interwave.m 2KB
共 14 条
- 1
资源评论
海神之光
- 粉丝: 3w+
- 资源: 2092
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 沈丘盛世龙门图纸符合规范化
- HM3400-VB一款N-Channel沟道SOT23的MOSFET晶体管参数介绍与应用说明
- 基于python+streamlit联邦学习进行高校学生成绩预测研究python源码+项目说明+模型+数据.zip
- HM3400D-VB一款N-Channel沟道SOT23的MOSFET晶体管参数介绍与应用说明
- HM3400B-VB一款N-Channel沟道SOT23的MOSFET晶体管参数介绍与应用说明
- spring-boot示例
- 搜集火星资源.py
- JAR应用启动停止脚本化解决方案.zip
- 配合eclipse svn插件subclipse-4.3.4版本的javahl
- Bash脚本教程:如何优雅地停止JAR服务.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功