-
Notifications
You must be signed in to change notification settings - Fork 146
/
STTC_simulation.m
28 lines (26 loc) · 1.12 KB
/
STTC_simulation.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
% STTC_simulation.m
% To simulate the STTC (Space-Time Trellis Coding) scheme
%MIMO-OFDM Wireless Communications with MATLAB¢ç Yong Soo Cho, Jaekwon Kim, Won Young Yang and Chung G. Kang
%2010 John Wiley & Sons (Asia) Pte Ltd
clear, clf
N_frame=130; N_Packets=1000; N_Packets=100; %state='8_State_4PSK';
NT=2; NR=2; zf=3; SNRdBs=5:2:11; %SNRdBs=5:5:11;
for iter=1:4
if iter==1, state='4_State_4PSK'; gs='-ko';
elseif iter==2, state='8_State_4PSK'; gs='-ks';
elseif iter==3, state='16_State_4PSK'; gs='-k+';
else state='32_State_4PSK'; gs='-kx';
end
[dlt,slt,M] = STTC_stage_modulator(state,NR);
data_source = data_generator(N_frame,N_Packets,M,zf);
data_encoded = trellis_encoder(data_source,dlt,slt);
mod_sig = STTC_modulator(data_encoded,M);
for i_SNR=1:length(SNRdBs)
[signal,ch_coefs] = channel1(mod_sig,SNRdBs(i_SNR),NR);
[data_est,state_est] = STTC_detector(signal,dlt,slt,ch_coefs);
[N_frame1,space_dim,N_packets] = size(data_est);
FER(i_SNR) = sum(sum(data_source~=data_est)>0)/N_packets;
end
semilogy(SNRdBs,FER,gs), hold on
end
title('BER of STTC coding')