Topic Text | Topic Comments (1) | Topic Properties | Topic Information | waqasanjum86@gma... |

Topic title: bcdbsab |
Monday August 18, 2014 18:59:43 |

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 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||

12 | |||

13 | clc;clear all;close all; | ||

14 | format compact; | ||

15 | %%% Standard pdps | ||

16 | pdp(1).name = 'EPA'; | ||

17 | pdp(1).tau = [ 0 30 70 90 110 190 410 ]*1e-9; % path delays | ||

18 | pdp(1).pdb = [ 0 -1.0 -2.0 -3.0 -8.0 -17.2 -20.8 ]; % path gains in dB | ||

19 | |||

20 | pdp(2).name = 'ETU'; | ||

21 | pdp(2).tau = [ 0 50 120 200 230 500 1600 2300 5000 ]*1e-9; % path delays | ||

22 | 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 | ||

23 | |||

24 | pdp(3).name = 'EVA'; | ||

25 | pdp(3).tau = [ 0 30 150 310 370 710 1090 1730 2510 ]*1e-9; % path delays | ||

26 | pdp(3).pdb = [ 0 -1.5 -1.4 -3.6 -0.6 -9.1 -7.0 -12.0 -16.9 ];% path gains in dB | ||

27 | |||

28 | %%% Modified Debug point 1: Test pdp,freq. flat channel ... | ||

29 | pdp(4).name = 'TEST'; | ||

30 | pdp(4).tau = [0 ]*1e-9; % path delays | ||

31 | pdp(4).pdb = [0 ]; % path gains in dB | ||

32 | pdpNameCellArray = {pdp(1).name, pdp(2).name, pdp(3).name,pdp(4).name }; | ||

33 | |||

34 | selectedPdpName = 'EPA'; %%mine pdp name | ||

35 | selectedPdpIndex = find(strcmp(pdpNameCellArray,selectedPdpName)); | ||

36 | |||

37 | %%% Supported Modulation Schemes | ||

38 | mod(1).name = 'BPSK'; mod(1).modSymb = 2; % name & symbols count | ||

39 | mod(2).name = 'QPSK'; mod(2).modSymb = 4; | ||

40 | mod(3).name = '8PSK'; mod(3).modSymb = 8; | ||

41 | mod(4).name = '16QAM'; mod(4).modSymb =16; | ||

42 | modCellArray = {mod(1).name, mod(2).name, mod(3).name,mod(4).name}; | ||

43 | |||

44 | select_modName = '16QAM'; | ||

45 | selected_modIndex = find(strcmp(modCellArray,select_modName)); | ||

46 | |||

47 | %%% Parameters | ||

48 | %%% Simulation parameters | ||

49 | params.sim.OFDMSymb= 2; % Total OFDM Symbols | ||

50 | params.sim.mod=mod(selected_modIndex).name; % Selected Modulation type | ||

51 | %%% System parameters | ||

52 | params.sys.nCarr = 512; % Total Subcarriers | ||

53 | params.sys.LEN_CP= 144; % Total no. of CP | ||

54 | params.sys.ts=1/(30.72e6); % Sampling time | ||

55 | params.sys.LEN_DATA=params.sys.nCarr*params.sim.OFDMSymb*log2(mod(selected_modIndex).modSymb); | ||

56 | %%% Channel parameters | ||

57 | params.chan.fd=0; % Doppler frequency | ||

58 | params.chan.tau=pdp(selectedPdpIndex).tau; % pdp delay | ||

59 | params.chan.pdb=pdp(selectedPdpIndex).pdb; % pdp power(db) | ||

60 | mode='td'; % frequency-domain or time-domain | ||

61 | |||

62 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||

63 | %%% Generate Random Data | ||

64 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||

65 | |||

66 | txData = randi([0,1] , 1 , params.sys.LEN_DATA); % Random integer data b/w 0 to 1 | ||

67 | |||

68 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||

69 | %%% OFDM Transmitter : | ||

70 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||

71 | %%% Check point 01 : Most of signal processing is in time domain. | ||

72 | %%% add new variable here later ....mine editing | ||

73 | |||

74 | [mod_TXsym,ofdm_td_TXdata]=ofdm_transmitter(txData,params); | ||

75 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||

76 | %%% Multipath Rayleigh Channel : | ||

77 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||

78 | [ofdm_rx_signal,channel_cir,channel_cfr]=Chan_rayleigh(ofdm_td_TXdata,mod_TXsym,params,mode); | ||

79 | |||

80 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||

81 | %%% OFDM Receiver : | ||

82 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||

83 | |||

84 | %%% Modified Debug point 2: ofdm_td_TXdata and channel_cir are additional arguments passed to | ||

85 | %%% ofdm_receiver used in MMSE computation ... | ||

86 | |||

87 | [demod_RXsym ,demod_RX_bits]=ofdm_receiver(ofdm_rx_signal,ofdm_td_TXdata,..... | ||

88 | channel_cir,channel_cfr,params); | ||

89 | |||

90 | % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||

91 | % % %%% BER & SER Calculation : | ||

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.