How can I simulate the MIMO section only?
4 views (last 30 days)
Show older comments
I am using the example found here: https://uk.mathworks.com/help/phased/ug/improve-snr-and-capacity-of-wireless-communication-using-antenna-arrays.html?searchHighlight=ULA%20MIMO&s_tid=srchtitle_support_results_24_ULA%2520MIMO
How can I just simulate the MIMO section without using the helperMIMOBER function in the example? as the version of MATLAB I am using does not support the function nargin.
I need to simulate this so I can compared existing SISO results which I have obtained previously.
2 Comments
Sam Chak
on 18 Apr 2024
Hi @Liam, I couldn't locate the custom helperMIMOBER() function in the provided link. However, @Star Strider shared the function in this comment, and the nargin command is not a new command or function.
function nber = helperMIMOBER(chan, x, snr_param, wt, wr)
Nsamp = size(x,1);
Nrx = size(chan,2);
Ntx = size(chan,1);
if nargin < 4
wt = ones(1,Ntx);
end
if nargin < 5
wr = ones(Nrx,1);
end
xt = 1/sqrt(Ntx)*(2*x-1)*wt; % map to bpsk
nber = zeros(Nrx,numel(snr_param),‘like’,1); % real
for m = 1:numel(snr_param)
n = sqrt(db2pow(-snr_param(m))/2)*(randn(Nsamp,Nrx)+1i*randn(Nsamp,Nrx));
y = xt*chan*wr+n*wr;
xe = real(y)>0;
nber(:,m) = sum(x~=xe);
end
end
Answers (1)
Sam Chak
on 21 Apr 2024
While I'm not an expert in BPSK and QPSK, I haven't encountered any problems when running the script in the link you provided and 'helperMIMOBER()' code on this MATLAB Answers forum.
%% The Script:
c = 3e8; % propagation speed
fc = 60e9; % carrier frequency
lambda = c/fc; % wavelength
txcenter = [0;0;0];
rxcenter = [1500;500;0];
[~,txang] = rangeangle(rxcenter,txcenter);
[~,rxang] = rangeangle(txcenter,rxcenter);
txsipos = [0;0;0];
rxsopos = [0;0;0];
g = 1; % gain for the path
sisochan = scatteringchanmtx(txsipos,rxsopos,txang,rxang,g);
Nsamp = 1e6;
x = randi([0 1],Nsamp,1);
ebn0_param = -10:2:10;
Nsnr = numel(ebn0_param);
% Now, we call the helperMIMOBER() function:
ber_siso = helperMIMOBER(sisochan,x,ebn0_param)/Nsamp
%% the helperMIMOBER() function
function nber = helperMIMOBER(chan, x, snr_param, wt, wr)
Nsamp = size(x,1);
Nrx = size(chan,2);
Ntx = size(chan,1);
if nargin < 4
wt = ones(1,Ntx);
end
if nargin < 5
wr = ones(Nrx,1);
end
xt = 1/sqrt(Ntx)*(2*x-1)*wt; % map to bpsk
nber = zeros(Nrx,numel(snr_param), 'like', 1); % real
for m = 1:numel(snr_param)
n = sqrt(db2pow(-snr_param(m))/2)*(randn(Nsamp,Nrx)+1i*randn(Nsamp,Nrx));
y = xt*chan*wr+n*wr;
xe = real(y)>0;
nber(:,m) = sum(x~=xe);
end
end
0 Comments
See Also
Categories
Find more on BPSK in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!