Continue to Site

# MIMO system Matlab help

Status
Not open for further replies.

#### medototy

##### Newbie level 6
hi, in my matlab code stream of data, I'll do it in program like this steps:
N=??; % length of each frame
L=??; % total number of frames
for i=1:L
y=H*s,(i-1)*N+1:i*N)+W;
-------
-------
end
In above steps I suppose the system deal with all data as one stream, now I want to divide the data in to 4 parts (4 sub-streams) to use it in the same above steps, is there any one can help me please at once.
THANKS

hi, in my matlab code stream of data, I'll do it in program like this steps:
N=??; % length of each frame
L=??; % total number of frames
for i=1:L
y=H*s,(i-1)*N+1:i*N)+W;
-------
-------
end
In above steps I suppose the system deal with all data as one stream, now I want to divide the data in to 4 parts (4 sub-streams) to use it in the same above steps, is there any one can help me please at once.
THANKS

Define N as the number of bits per stream and L as the number of streams, you can write the following in MATLAB

Code:
b=randn(L,N)>0.5;%This is the 0 1 streams
d=2.*b-1;%This is the corresponding -1 +1 streams

Thanks David83 for your comment, but I need steps like this:
Code:
    Nt = 4;
Nr = 4;
EbNo = 0:3:25;                 % SNR dB
N = 5;                             % The length of each frame
L = 100;                           % the total number of frames
M = 16;                            % MQAM Modulation
x = randi(M,Nt,N*L)-1;        % Generate Signal source
sm = qammod(x,M,0);            % M-QAM Modulation
s = 1/sqrt(Nt)*sm*1/sqrt(10);
Const_size = sqrt(M);
Constellationform = -(Const_size-1):2:Const_size-1;
Constellation = 1/sqrt(Nt)*Constellationform*1/sqrt(10);
for index1 = 1:length(EbNo)
x2 = [];
for  index2 = 1:L        % Assume that the channel remains unchanged in every frame
H_complex = (randn(Nr,Nt)+1j*randn(Nr,Nt))./sqrt(2);    % Flat Rayleigh fading channel
sigma(index1) = sqrt(1/(10.^(EbNo(index1)/10)));   % the MSE(mean square error) of Noise, SNR=1/(sigma)^2
w_complex = sigma(index1)*(randn(Nr,N)+1j*randn(Nr,N))./sqrt(2);
y_complex = H_complex*s(:,(index2-1)*N+1:index2*N)+w_complex;      % The received signal   Y=HX+W
H = [[real(H_complex) -imag(H_complex)]; [imag(H_complex) real(H_complex)]];  % turn into real-valued
y = [real(y_complex); imag(y_complex)];
w = [real(w_complex); imag(w_complex)];
Please can you help me to modify the above steps to get the same work but by divide the original data in to 4 sub-streams.
THANKS

Last edited by a moderator:

Thanks David83 for your comment, but I need steps like this:
Code:
    Nt = 4;
Nr = 4;
EbNo = 0:3:25;                 % SNR dB
N = 5;                             % The length of each frame
L = 100;                           % the total number of frames
M = 16;                            % MQAM Modulation
x = randi(M,Nt,N*L)-1;        % Generate Signal source
sm = qammod(x,M,0);            % M-QAM Modulation
s = 1/sqrt(Nt)*sm*1/sqrt(10);
Const_size = sqrt(M);
Constellationform = -(Const_size-1):2:Const_size-1;
Constellation = 1/sqrt(Nt)*Constellationform*1/sqrt(10);
for index1 = 1:length(EbNo)
x2 = [];
for  index2 = 1:L        % Assume that the channel remains unchanged in every frame
H_complex = (randn(Nr,Nt)+1j*randn(Nr,Nt))./sqrt(2);    % Flat Rayleigh fading channel
sigma(index1) = sqrt(1/(10.^(EbNo(index1)/10)));   % the MSE(mean square error) of Noise, SNR=1/(sigma)^2
w_complex = sigma(index1)*(randn(Nr,N)+1j*randn(Nr,N))./sqrt(2);
y_complex = H_complex*s(:,(index2-1)*N+1:index2*N)+w_complex;      % The received signal   Y=HX+W
H = [[real(H_complex) -imag(H_complex)]; [imag(H_complex) real(H_complex)]];  % turn into real-valued
y = [real(y_complex); imag(y_complex)];
w = [real(w_complex); imag(w_complex)];
Please can you help me to modify the above steps to get the same work but by divide the original data in to 4 sub-streams.
THANKS

Without getting technical, after generating the streams as I indicated for BPSK (adjust this for other modulations), for each SNR point generate the channel matrix H (with the correct dimensions), and the noise vector N. Then you form the received signal as Y=H*d+N.

Status
Not open for further replies.