Topic Text   Topic Comments (0)   Topic Properties   Topic Information waqasanjum86@gma...
Topic title: Test work Tuesday August 19, 2014 21:06:46

Download topic text | View in monospace font | Tab width set to 8 (change to 4)

Files in topic:  
[Jump to] main_call_OFDM.m   {+99,-0}

[Add General Comment] to topic.

File main_call_OFDM.m (Revision 1.0) [Add File Comment] [Top]
 
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 % Description: Implementation of basic OFDM based transceiver with multipath
3 % rayleigh channel.
4 % OFDM TX : Data -- Mod -- Ser2Par -- IFFT -- CP --- Rayleigh Channel
5 %
6 % OFDM RX : DeMod -- Par2Ser -- FFT -- Remove CP --- OFDM Rx Data
7 % Description : Main script file for OFDM transceiver with rayleigh channel.
8 % Revision I : 1-Addition of higher order modulation/demod. schemes.
9 % 2-Integration of OFDM transceiver with rayleigh channel.
10 % 3-Check Point : Checkpoint added needs reviewing.
11 % Revision II: 17th August 2014
12 % Pilots data is added for channel estimation.Based upon
13 % pilot data channel information embedded is extracted.Phase
14 % correction and channel equalization is applied.
15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16
17 clc;clear all;close all;format compact;
18 %%% Standard pdps
19 pdp(1).name = 'EPA';
20 pdp(1).tau = [ 0 30 70 90 110 190 410 ]*1e-9; % path delays
21 pdp(1).pdb = [ 0 -1.0 -2.0 -3.0 -8.0 -17.2 -20.8 ]; % path gains in dB
22
23 pdp(2).name = 'ETU';
24 pdp(2).tau = [ 0 50 120 200 230 500 1600 2300 5000 ]*1e-9; % path delays
25 pdp(2).pdb = [ -1.0 -1.0 -1.0 0.0 0.0 0.0 -3.0 -5.0 -7.0 ]; % path gains in dB
26
27 pdp(3).name = 'EVA';
28 pdp(3).tau = [ 0 30 150 310 370 710 1090 1730 2510 ]*1e-9; % path delays
29 pdp(3).pdb = [ 0 -1.5 -1.4 -3.6 -0.6 -9.1 -7.0 -12.0 -16.9 ];% path gains in dB
30
31 pdpNameCellArray = {pdp(1).name, pdp(2).name, pdp(3).name};
32 selectedPdpName = 'EVA';
33 selectedPdpIndex = find(strcmp(pdpNameCellArray,selectedPdpName));
34
35 %%% Supported Modulation Schemes
36 mod(1).name = 'BPSK'; mod(1).modSymb = 2; % Name & Symbols count
37 mod(2).name = 'QPSK'; mod(2).modSymb = 4;
38 mod(3).name = '8PSK'; mod(3).modSymb = 8;
39 mod(4).name = '16QAM'; mod(4).modSymb =16;
40 modCellArray = {mod(1).name, mod(2).name, mod(3).name,mod(4).name};
41
42 select_modName = '16QAM';
43 selected_modIndex = find(strcmp(modCellArray,select_modName));
44
45 %%% Parameters
46 %%% Simulation parameters
47 params.sim.OFDMSymb = 4; % Total OFDM Symbols
48 params.sim.pilotSym = 1; % Block based pilot symbol for channel Est.
49 params.sim.mod=mod(selected_modIndex).name; % Selected Modulation type
50 %%% System parameters
51 params.sys.nCarr = 2048; % Total Subcarriers
52 params.sys.LEN_CP= 144; % Total no. of CP
53 params.sys.ts=1/(30.72e6); % Sampling time
54 params.sys.LEN_DATA=params.sys.nCarr*params.sim.OFDMSymb*log2(mod(selected_modIndex).modSymb);
55 %%% Channel parameters
56 params.chan.fd=0; % Doppler frequency
57 params.chan.tau=pdp(selectedPdpIndex).tau; % pdp delay
58 params.chan.pdb=pdp(selectedPdpIndex).pdb; % pdp power(db)
59 mode='td'; % frequency-domain or time-domain
60
61 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
62 %%% Generate Random Data
63 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
64
65 txData = randi([0,1] , 1 , params.sys.LEN_DATA); % Random integer data b/w 0 to 1
66
67 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
68 %%% OFDM Transmitter :
69 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
70
71 [mod_TXsym,ofdm_td_TXdata]=ofdm_transmitter(txData,params);
72
73 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
74 %%% Multipath Rayleigh Channel :
75 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
76
77 [ofdm_rx_signal,channel_cir,channel_cfr]=Chan_rayleigh(ofdm_td_TXdata,mod_TXsym,params,mode);
78
79 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
80 %%% OFDM Receiver :
81 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
82
83 %%% Modified Debug point 1: ofdm_td_TXdata and channel_cir are additional arguments passed to
84 %%% ofdm_receiver used in MMSE computation ...
85
86 [demod_RXsym ,demod_RX_bits]=ofdm_receiver(ofdm_rx_signal,ofdm_td_TXdata,.....
87 channel_cir,channel_cfr,params);
88
89 % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
90 % % %%% BER & SER Calculation :
91 % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92
93 % symErr = length(find(abs(mod_TXsym(:) - demod_RXsym)))
94 % SER = symErr/length(demod_RXsym) %SER
95 %%% BER Calculations
96 bitErr = length(find(abs(txData - demod_RX_bits)))
97 BER = bitErr/params.sys.LEN_DATA %BER
 
  
Legend:
Removed 
Changed
 Added

[Add General Comment] to topic.