不知道能不能高亮显示,频偏仿真。
痴心男http://im.cx/n
posted @ 2010年5月16日 04:44
in 未分类
, 1560 阅读
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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | %************************************************************************** %The simulation adopted the model in paper "ML estimation of time and %frequency offset" written by J.J van de Beek e.t.Programmed by binyue-Liu %************************************************************************** close all ; clear all ; N=1024; %length of one symbol L=128; %length of CP SNR=15; Symbol_num=6; Bit_sym=4; %16_QAM s=randint(1,N*Symbol_num*Bit_sym); s_map=qammod(2.^(Bit_sym-1:-1:0)* reshape (s,Bit_sym,N*Symbol_num),16); %Reflecting to the 16_QAM constallation t= ifft ( reshape (s_map,N,Symbol_num))*N; %OFDM modulation t_add_CP=[t(N-L+1:N,:);t]; %Addition with CP SNR_line=10^(SNR/10); transmit= reshape (t_add_CP,1,(N+L)*Symbol_num); sigmma=(1^2+3^2)/2/SNR_line; Noise=( randn (1,(N+L)*Symbol_num)+ j * randn (1,(N+L)*Symbol_num))* sqrt (sigmma/2); recieve= zeros (1,Symbol_num*(N+L)); erro_rate= zeros (1,10); index=1; for e=0.02:0.01:0.12; %The offset of norminal carrier frequency for i =1:Symbol_num; k=1:N+L; recieve(( i -1)*(N+L)+1:(N+L)* i )=transmit(( i -1)*(N+L)+1:(N+L)* i ).* exp ( j *2* pi *e*k/N); end r= reshape (recieve+Noise,N+L,Symbol_num); r1= reshape ( fft (r(L+1: end ,:))/N,1,N*Symbol_num); Out_symbol=qamdemod(r1,16); Out_bit= zeros (4,N*Symbol_num); for i =1:N*Symbol_num; for k=1:Bit_sym Out_bit(k, i )= floor (Out_symbol( i )/(2^(Bit_sym-k))); if Out_bit(k, i )==1 Out_symbol( i )=Out_symbol( i )-2^(Bit_sym-k); else end end end Out_bit= reshape (Out_bit,1,Bit_sym*N*Symbol_num); erro_rate(index)= length ( find (Out_bit~=s))/ length (s); index=index+1; end semilogy (0.02:0.01:0.12,erro_rate, '-*' ) axis ([0.01 0.12 10^(-5) 1]) |