forked from bb16177/OTFS-Simulation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemodOFDM.m
43 lines (38 loc) · 1.42 KB
/
demodOFDM.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
function [dataOut] = demodOFDM(dataIn,cpLen,ofdmSym)
%--------------------------------------------------------------------------
%
% Demodulates OFDM symbols into serial data
%
%--------------------------------------------------------------------------
% Definition of input arguments
%
% dataIn Input data vector
% cpLen Length of the cyclic prefix
% ofdmSym No. of ofdm symbols per subframe
%
%--------------------------------------------------------------------------
% Function returns:
%
% dataOut Output time domain symbols
%
%--------------------------------------------------------------------------
%
% Author: Bradley Bates
% University of Bristol, UK
% email address: [email protected]
% May 2020
%
% Code and algorithm originally from:
%
% Baher Mohammed (2020). OFDM signal generation, transmission and reception
% (https://www.mathworks.com/matlabcentral/fileexchange/28368-ofdm-signal-generation-transmission-and-reception)
% MATLAB Central File Exchange. Retrieved May 10, 2020.
%
%--------------------------------------------------------------------------
% OFDM receiever reshapes serial data to parallel
parallelRx = reshape(dataIn, numel(dataIn)/ofdmSym, ofdmSym);
% Removing the cyclic Prefix
parallelRx(1:(cpLen), :) = [];
% Perform FFT
dataOut = fft(parallelRx,[],2);
end