%OFDM.m
% This simulation is part of the textbook (Hardback & eBook) “Fundamentals of Communication Systems”
% by Janak Sodha. All the theory in this book is supported by simulations via the
% app “Communication Systems” available in the Apple and Google Play store.
% Further details of the textbook, video lectures and simulations are on Amazon.com and iTunes
% Search by author surname.
clc
clear
close
echo on
T = 2;
fc = 1; %% Using fc for the subcarrier frequency
M = 16;
Eb = 15/6;
p = 0.5;
A = sqrt((3*Eb*Logtwo(M))/(2*(M - 1)));
a(1,1) = -3;
a(2,1) = -3;
a(3,1) = -3;
a(4,1) = -3;
a(5,1) = -1;
a(6,1) = -1;
a(7,1) = -1;
a(8,1) = -1;
a(9,1) = 3;
a(10,1) = 3;
a(11,1) = 3;
a(12,1) = 3;
a(13,1) = 1;
a(14,1) = 1;
a(15,1) = 1;
a(16,1) = 1;
b(1,1) = -3;
b(2,1) = -1;
b(3,1) = 3;
b(4,1) = 1;
b(5,1) = -3;
b(6,1) = -1;
b(7,1) = 3;
b(8,1) = 1;
b(9,1) = -3;
b(10,1) = -1;
b(11,1) = 3;
b(12,1) = 1;
b(13,1) = -3;
b(14,1) = -1;
b(15,1) = 3;
b(16,1) = 1;
%% To check complex representation of QAM signal is correct
%% for any given signal point
i = 3; %Select any signal point between 0 to 15
PlotSignal((i+1), A, T, fc, a, b)
%% To plot the QAM signal constellation diagram
pause
close
PlotSignalSpace(M, Eb, T, A, fc, a, b)
%% Now to extract a[] from X
echo off
for i = 0 : 15
disp(real(X(i+1, A, a, b)));
end
echo on
%% Now to extract b[] from X
echo off
for i = 0 : 15
disp(imag(X(i+1, A, a, b)));
end
echo on
%% To check demod function
SNR = 100; %Essentially Noiseless
echo off
for i = 1:1:M
Constellation(i).hor = quadl('xhsi', 0,T, [], [], i, A, T, fc, a, b);
Constellation(i).ver = quadl('xvsi', 0,T, [], [], i, A, T, fc, a, b);
end
echo on
%Generate two binary digits randomly
echo off
for bit = 1 : 1: Logtwo(M)
symbol(bit,1) = BinarySource(p);
end
echo on
signalpoint = Binary2Dec(symbol)
%Given that Matlab cannot handle an array with subscript zero,
%we are forced to add 1 to the signal point value, to change the range
% from 0 - 15 to 1 - 16.
tempsignalpoint = signalpoint + 1;
recpoint = AWGN(tempsignalpoint, SNR, Eb, Constellation);
recsymbol = Demod(recpoint, Constellation, Eb, M);
recpoint = recsymbol - 1 %To recover the signal point
%% OFDM Simulation under noiseless channel
K = 16; %Try different values
[SignalPoints, RecPoints, XX, Xprime, x, Y] = OFDMDCS(K, A, a, b, Constellation, Eb, M, p);
%% Signal points transmitted
SignalPoints
%% Signal points Decoded
RecPoints
%% XX array
XX
%% Xprime array
Xprime
%% x sequence
x
%% Y points to be demodulated
Y
%% To plot OFDM baseband signal
pause
close
N = 2*(K + 1);
Plotvbaseband(XX, K, T, N, x)
%% To plot OFDM bandpass signal
pause
close
fshift = 10; % Note that fshift here is the frequency shift
%% of the OFDM baseband signal
%% and not the subcarrier frequency.
Plotvbandpass(XX, K, T, fshift)
![avatar](https://profile-avatar.csdnimg.cn/5d2ad3b2ff2b438ea06fae8e9cde891e_m0_57702748.jpg!1)
天天Matlab代码科研顾问
- 粉丝: 3w+
- 资源: 4139
最新资源
- 智慧社区解决方案-6PPT(25页).pptx
- 40页-智慧社区一体化建设方案(重庆).pdf
- 智慧社区人脸识别整体解决方案Word(20页).doc
- 41页-智慧社区解决方案.pdf
- 智慧社区理念与解决方案介绍PPT(22页).pptx
- Springboot+vue的智能家居系统(有报告),Javaee项目,springboot vue前后端分离项目
- 智慧社区解决方案-10Word(253页).docx
- 智慧社区解决方案——智能安防建设解决方案PPT(69页).pptx
- Linux环境中Alist服务端安装与配置方法全解析
- Linux系统中JDK安装与环境配置教程
- 西门子PLC 200 Smart恒压供水编程之旅:昆仑通态触摸屏与ABB变频器参数设置实战学习视频分享,西门子PLC 200SMART恒压供水编程实战:昆仑通态触摸屏与ABB变频器参数设置学习指南及上
- 方钢管混凝土构件火灾、撞击与爆炸耦合模型解析视频教程:ABAQUS CAE+ODB应用实战,方钢管混凝土构件火灾、撞击与爆炸耦合模型解析教程:ABAQUS CAE+ODB应用详解,方钢管混凝土构件火灾
- 深度学习算法在噬菌体特异性蛋白质预测中的应用:完整代码实现与数据集分析,深度学习算法在噬菌体特异性蛋白质预测中的应用:完整代码实现与数据集分析,使用深度学习方法预测噬菌体特异性蛋白质完整代码实现,含数
- 基于国际大厂ADS1242的24bit二阶sigma delta ADC技术,应用于BIM的人体阻抗测量前端AFE芯片,采用smic55nm工艺,真实仿真非虚拟库实现 ,国际大厂ADS1242 AFE
- StarFree开源的简约唯美的论坛源码
- 基于布莱克曼窗的99阶FIR滤波器设计,实现50MHz采样频率下的1.5MHz通带滤波,图例展示滤波效果,Quartus仿真下的FIR滤波器设计:采用布莱克曼窗,99阶,50MHz采样频率与1.5MH
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![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)