# How to change this program from MIMO to SIMO

1. ## How to change this program from MIMO to SIMO

How to change this problem from MIMO to SIMO ?

```Code dot - [expand]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
120
121
122
123
124
clear all
SP.FFTsize=128;
numSymbols=SP.FFTsize;
m1=4;
SP.inputBlockSize=32;
N=64;
Q=numSymbols/SP.inputBlockSize;
SP.detection_type='ZFE';
SP.sucariermapping='IFDMA';
SP.CPsize=20;
SP.subband = 0;
SP.numRun =100;
M=16;

SP.ep1=0;
SP.ep2=0;
SP.ep3=0;
SP.ep4=0;
numSymbols = SP.FFTsize;
A1=exp((1*1i*2*piSP.ep1/(numSymbols))(0:(numSymbols-1)));
A2=exp((1*1i*2*piSP.ep2/(numSymbols))(0:(numSymbols-1)));
CT1=diag(A1)*ifft(eye(numSymbols));
CT2=diag(A2)*ifft(eye(numSymbols));
SP.SNR=0:5:40;
for n = 1:length(SP.SNR)
for k = 1:SP.numRun
SP.channel=(1/sqrt(7))*(randn(4,8)+sqrt(-1)*randn(4,8))/sqrt(2);
h1=SP.channel(1,:);
h2=SP.channel(2,:);
h3=SP.channel(3,:);
h4=SP.channel(4,:);
H_channel11=fft(h1,SP.FFTsize);
H_channel12=fft(h2,SP.FFTsize);
H_channel21=fft(h3,SP.FFTsize);
H_channel22=fft(h4,SP.FFTsize);

data1=randi([0 M-1],1,48);
data1=data1.';
inputSymbols1=qammod(data1,M);
I1=eye(N);
v_phi=1:4:64;
I1(:,v_phi)=[];
inputSymbols11=I1*inputSymbols1;
m2=4;
data2=randi([0 M-1],1,48);
data2=data2.';
inputSymbols2=qammod(data2,M);
I2=eye(N);
v_phi2=2:4:64;
I2(:,v_phi2)=[];
inputSymbols22=I2*inputSymbols2;
inputSymbols_freq1=fft(inputSymbols11(1:2:end));
inputSymbols_freq2=fft(inputSymbols11(2:2:end));
inputSamples_ifdma1=zeros(1,numSymbols);
inputSamples_ifdma2=zeros(1,numSymbols);
inputSamples_lfdma1=zeros(1,numSymbols);
inputSamples_lfdma2=zeros(1,numSymbols);
if SP.sucariermapping=='IFDMA' inputSamples_ifdma1(1+SP.subband:Q:numSymbols)=inp utSymbols_freq1; inputSamples_ifdma2(1+SP.subband:Q:numSymbols)=inp utSymbols_freq2; inputSamples_lfdma3=ifft(inputSamples_ifdma1); inputSamples_lfdma4=ifft(inputSamples_ifdma2); else inputSamples_lfdma1(1:SP.inputBlockSize)=inputSymb ols_freq1; inputSamples_lfdma2(1:SP.inputBlockSize)=inputSymb ols_freq2; inputSamples_lfdma3=ifft(inputSamples_lfdma1); inputSamples_lfdma4=ifft(inputSamples_lfdma2);
end
TxSamples_lfdma1= [inputSamples_lfdma3(numSymbols-SP.CPsize+1:numSymbols) inputSamples_lfdma3]; TxSamples_lfdma2 = [inputSamples_lfdma4(numSymbols-SP.CPsize+1:numSymbols) inputSamples_lfdma4];
RxSamples_lfdma11 = filter(h1, 1, TxSamples_lfdma1); % Multipath Channel
RxSamples_lfdma12= filter(h2, 1,TxSamples_lfdma2 ); % Multipath Channel
RxSamples_lfdma21= filter(h3, 1,TxSamples_lfdma1 ); % Multipath Channel
RxSamples_lfdma22= filter(h4, 1,TxSamples_lfdma2 ); % Multipath Channel

tmpn = randn(2,numSymbols+SP.CPsize);
complexNoise = (tmpn(1,:) + 1i*tmpn(2,:))/sqrt(2);
noisePower =(10^(-SP.SNR(n)/10));
rx1=RxSamples_lfdma11+RxSamples_lfdma12+sqrt(noise Power/Q)*complexNoise ;
rx2= RxSamples_lfdma21+ RxSamples_lfdma22+sqrt(noisePower/Q)*complexNoise;
RxSamples_ifdma1= rx1.*exp((-1i*2*pi*SP.ep1/(numSymbols))*(-SP.CPsize:(numSymbols-1)));
RxSamples_ifdma2= rx2.*exp((-1i*2*pi*SP.ep1/(numSymbols))*(-SP.CPsize:(numSymbols-1)));
rx1_ = rx1(SP.CPsize+1:numSymbols+SP.CPsize);
rx2_ = rx2(SP.CPsize+1:numSymbols+SP.CPsize);
Y_lfdma11=fft(rx1_,SP.FFTsize);
Y_lfdma22=fft(rx2_,SP.FFTsize);
if SP.sucariermapping=='IFDMA'
Y_lfdma1=Y_lfdma11(1+SP.subband:Q:numSymbols);
Y_lfdma2=Y_lfdma22(1+SP.subband:Q:numSymbols);
H_eff11=H_channel11(1+SP.subband:Q:numSymbols);
H_eff12=H_channel12(1+SP.subband:Q:numSymbols);
H_eff21=H_channel21(1+SP.subband:Q:numSymbols);
H_eff22=H_channel22(1+SP.subband:Q:numSymbols);
else
Y_lfdma1=Y_lfdma11(1:SP.inputBlockSize);
Y_lfdma2=Y_lfdma22(1:SP.inputBlockSize);
H_eff11=H_channel11(1:SP.inputBlockSize);
H_eff12=H_channel12(1:SP.inputBlockSize);
H_eff21=H_channel21(1:SP.inputBlockSize);
H_eff22=H_channel21(1:SP.inputBlockSize);
end
A1=diag(H_eff11);
A2=diag(H_eff12);
A3=diag(H_eff21);
A4=diag(H_eff22);
AT=[A1 A2;A3 A4];
alpha_1=0.1;
alpha_2=0.1;
c1=A3*inv(A1);
c2=A2*inv(A4);
%ZF DETECTOR
if SP.detection_type=='ZFE'
C=inv(AT);
Y_lfdma33=( C*[Y_lfdma1,Y_lfdma2].').';
elseif SP.detection_type=='RZF'
C=inv(AT'*AT+1/10^(SP.SNR(n)/10)*eye(2*SP.inputBlockSize))*AT';
Y_lfdma33=(C*[Y_lfdma1,Y_lfdma2].').';
end
EstSymbols_lfdma=zeros(1,2*SP.inputBlockSize);
EstSymbols_lfdma(1:2:end)=ifft(Y_lfdma33(1:end/2));
EstSymbols_lfdma(2:2:end)=ifft(Y_lfdma33(1+end/2:end));
demodata_lfdma=qamdemod(EstSymbols_lfdma,M);

Y_ofdmaC=I1.'*demodata_lfdma.';
end
[~,ber_ofdm(k)]=biterr(data1,Y_ofdmaC);
BER_ofdm(n) =mean(ber_ofdm);
end
semilogy(SP.SNR,BER_ofdm,'k--s');
legend('SM SC-FDMA')
xlabel('SNR (dB)'); ylabel('BER');
title('MMSE Equalization,QAM')
axis([0 35 1e-4 1 ])
grid```

•

--[[ ]]--