correct for these codes and help me to get running codes
% System parameters
M = 50; % Number of antennas
K = 3; % Number of terminals
SNR_dB = 20; % SNR in dB
numSymbols = 1e4; % Number of symbols for simulation
L_prime = 5; % L’ = 5
% QPSK Modulator and Demodulator
qpskMod = comm.QPSKModulator(‘BitInput’, false);
qpskDemod = comm.QPSKDemodulator(‘BitOutput’, false);
% Generate random data symbols
dataSymbols = randi([0 3], K, numSymbols);
% Generate transmitted symbols (QPSK)
txSymbols = step(qpskMod, dataSymbols(:)); % Corrected input format
txSymbols = reshape(txSymbols, [], K);
% Channel matrix
H = (randn(M, K) + 1i*randn(M, K))/sqrt(2);
% Received signal with AWGN
rxSignal = awgn(H .* txSymbols, SNR_dB, ‘measured’); % Transpose to match dimensions
% MRC Combining
combiner_MRC = conj(H);
rxCombined_MRC = combiner_MRC * rxSignal;
% ZF Combining
combiner_ZF = pinv(H);
rxCombined_ZF = combiner_ZF * rxSignal;
% Demodulate received symbols
rxDataSymbols_MRC = step(qpskDemod, rxCombined_MRC(:));
rxDataSymbols_ZF = step(qpskDemod, rxCombined_ZF(:));
% Decision threshold (for QPSK, it’s zero)
detected_MRC = rxDataSymbols_MRC > 0;
detected_ZF = rxDataSymbols_ZF > 0;
% Reshape for plotting
rxCombined_MRC = reshape(rxCombined_MRC, [], 1);
rxCombined_ZF = reshape(rxCombined_ZF, [], 1);
% Plotting
figure;
subplot(1, 2, 1);
scatterplot(rxCombined_MRC);
title(‘MRC Receiver’);
xlabel(‘In-Phase’);
ylabel(‘Quadrature’);
axis equal; % Equal scaling on both axes
grid on;
subplot(1, 2, 2);
scatterplot(rxCombined_ZF);
title(‘ZF Receiver’);
xlabel(‘In-Phase’);
ylabel(‘Quadrature’);
axis equal; % Equal scaling on both axes
grid on;
sgtitle(‘Constellation of Estimated Symbols for K=3, M=50, L”=5, and rho=20 dB’);% System parameters
M = 50; % Number of antennas
K = 3; % Number of terminals
SNR_dB = 20; % SNR in dB
numSymbols = 1e4; % Number of symbols for simulation
L_prime = 5; % L’ = 5
% QPSK Modulator and Demodulator
qpskMod = comm.QPSKModulator(‘BitInput’, false);
qpskDemod = comm.QPSKDemodulator(‘BitOutput’, false);
% Generate random data symbols
dataSymbols = randi([0 3], K, numSymbols);
% Generate transmitted symbols (QPSK)
txSymbols = step(qpskMod, dataSymbols(:)); % Corrected input format
txSymbols = reshape(txSymbols, [], K);
% Channel matrix
H = (randn(M, K) + 1i*randn(M, K))/sqrt(2);
% Received signal with AWGN
rxSignal = awgn(H .* txSymbols, SNR_dB, ‘measured’); % Transpose to match dimensions
% MRC Combining
combiner_MRC = conj(H);
rxCombined_MRC = combiner_MRC * rxSignal;
% ZF Combining
combiner_ZF = pinv(H);
rxCombined_ZF = combiner_ZF * rxSignal;
% Demodulate received symbols
rxDataSymbols_MRC = step(qpskDemod, rxCombined_MRC(:));
rxDataSymbols_ZF = step(qpskDemod, rxCombined_ZF(:));
% Decision threshold (for QPSK, it’s zero)
detected_MRC = rxDataSymbols_MRC > 0;
detected_ZF = rxDataSymbols_ZF > 0;
% Reshape for plotting
rxCombined_MRC = reshape(rxCombined_MRC, [], 1);
rxCombined_ZF = reshape(rxCombined_ZF, [], 1);
% Plotting
figure;
subplot(1, 2, 1);
scatterplot(rxCombined_MRC);
title(‘MRC Receiver’);
xlabel(‘In-Phase’);
ylabel(‘Quadrature’);
axis equal; % Equal scaling on both axes
grid on;
subplot(1, 2, 2);
scatterplot(rxCombined_ZF);
title(‘ZF Receiver’);
xlabel(‘In-Phase’);
ylabel(‘Quadrature’);
axis equal; % Equal scaling on both axes
grid on;
sgtitle(‘Constellation of Estimated Symbols for K=3, M=50, L”=5, and rho=20 dB’); % System parameters
M = 50; % Number of antennas
K = 3; % Number of terminals
SNR_dB = 20; % SNR in dB
numSymbols = 1e4; % Number of symbols for simulation
L_prime = 5; % L’ = 5
% QPSK Modulator and Demodulator
qpskMod = comm.QPSKModulator(‘BitInput’, false);
qpskDemod = comm.QPSKDemodulator(‘BitOutput’, false);
% Generate random data symbols
dataSymbols = randi([0 3], K, numSymbols);
% Generate transmitted symbols (QPSK)
txSymbols = step(qpskMod, dataSymbols(:)); % Corrected input format
txSymbols = reshape(txSymbols, [], K);
% Channel matrix
H = (randn(M, K) + 1i*randn(M, K))/sqrt(2);
% Received signal with AWGN
rxSignal = awgn(H .* txSymbols, SNR_dB, ‘measured’); % Transpose to match dimensions
% MRC Combining
combiner_MRC = conj(H);
rxCombined_MRC = combiner_MRC * rxSignal;
% ZF Combining
combiner_ZF = pinv(H);
rxCombined_ZF = combiner_ZF * rxSignal;
% Demodulate received symbols
rxDataSymbols_MRC = step(qpskDemod, rxCombined_MRC(:));
rxDataSymbols_ZF = step(qpskDemod, rxCombined_ZF(:));
% Decision threshold (for QPSK, it’s zero)
detected_MRC = rxDataSymbols_MRC > 0;
detected_ZF = rxDataSymbols_ZF > 0;
% Reshape for plotting
rxCombined_MRC = reshape(rxCombined_MRC, [], 1);
rxCombined_ZF = reshape(rxCombined_ZF, [], 1);
% Plotting
figure;
subplot(1, 2, 1);
scatterplot(rxCombined_MRC);
title(‘MRC Receiver’);
xlabel(‘In-Phase’);
ylabel(‘Quadrature’);
axis equal; % Equal scaling on both axes
grid on;
subplot(1, 2, 2);
scatterplot(rxCombined_ZF);
title(‘ZF Receiver’);
xlabel(‘In-Phase’);
ylabel(‘Quadrature’);
axis equal; % Equal scaling on both axes
grid on;
sgtitle(‘Constellation of Estimated Symbols for K=3, M=50, L”=5, and rho=20 dB’); correct for these codes and help me to get running MATLAB Answers — New Questions