File: untitled.m Line: 1 Column: 5
Afficher commentaires plus anciens
C = 3e(8);
fc = 60e(9);
lambda = C/fc;
N = 2; % number of antenna in Tx
M = 2; % number of antenna in Rx
tx_location = [0;0;0];
rx_location = [1500;500;0];
[~,tx_theta] = rangeangle(rx_location,tx_location);
[~,rx_theta] = rangeangle(tx_location,rx_location);
Bw = 2*fc;
tx = [0;0;0];
rx = [0;0;0];
g = 1; % gain for the path
sisochan = scatteringchanmtx(tx,rx,tx_theta,rx_theta,g);
Ns = 1e6;
x = randi([0 1],Ns,1);
ebn0_param = -10:2:10;
SNR=0:2:20;
BER_SISO = helperMIMOBER(sisochan,x,ebn0_param)/Ns;
helperBERPlot(ebn0_param,BER_SISO);
legend('SISO')
C_SISO = Bw*log2(1+SNR );
% SIMO
rxarray = phased.ULA('NumElements',M,'ElementSpacing',lambda/2);
rxmopos = getElementPosition(rxarray)/lambda;
simochan = scatteringchanmtx(tx,rxmopos,tx_theta,rx_theta,g);
rxarraystv = phased.SteeringVector('SensorArray',rxarray,...
'PropagationSpeed',C);
wr = conj(rxarraystv(fc,rx_theta));
BER_SIMO = helperMIMOBER(simochan,x,ebn0_param,1,wr)/Ns;
helperBERPlot(ebn0_param,[BER_SISO(:) BER_SIMO(:)]);
legend('SISO','SIMO')
C_SIMO = Bw*log2(1+(M)*SNR);
%MISO
txarray = phased.ULA('NumElements',N,'ElementSpacing',lambda/2);
txmipos = getElementPosition(txarray)/lambda;
misochan = scatteringchanmtx(txmipos,rx,tx_theta,rx_theta,g);
txarraystv = phased.SteeringVector('SensorArray',txarray,...
'PropagationSpeed',C);
wt = txarraystv(fc,tx_theta)';
BER_MISO = helperMIMOBER(misochan,x,ebn0_param,wt,1)/Ns;
helperBERPlot(ebn0_param,[BER_SISO(:) BER_SIMO(:) BER_MISO(:)]);
legend('SISO','SIMO','MISO')
C_MISO = Bw*log2(1+(N)*SNR);
%MIMO
mimochan = scatteringchanmtx(txmipos,rxmopos,tx_theta,rx_theta,g);
C_MIMO = Bw*log2(1+(N)*(M)*SNR);
wt = txarraystv(fc,tx_theta)';
wr = conj(rxarraystv(fc,rx_theta));
BER_MIMO = helperMIMOBER(mimochan,x,ebn0_param,wt,wr)/Ns;
helperBERPlot(ebn0_param,[BER_SISO(:) BER_SIMO(:) BER_MISO(:) BER_MIMO(:)]);
legend('SISO (1*1)','SIMO (1*2)','MISO (2*1)','MIMO (2*2)')
xlabel('SNR (dB)')
ylabel('BER')
figure
plot(SNR,C_SISO(:),'-rs',SNR, C_SIMO(:),'*g',SNR, C_MISO(:),'--b',SNR, C_MIMO(:));
legend('SISO (1*1)','SIMO (1*2)','MISO (2*1)','MIMO (2*2)')
xlabel('SNR (dB)')
ylabel('Capacity (bit/s)')
3 commentaires
Saif Hoque
le 9 Août 2023
why i cant run this code Error in untitled2 (line 19)
BER_SISO = helperMIMOBER(sisochan,x,ebn0_param)/Ns;
Steven Lord
le 13 Août 2023
What happens when you try running that code?
- Do you receive warning and/or error messages? If so the full and exact text of those messages (all the text displayed in orange and/or red in the Command Window) may be useful in determining what's going on and how to avoid the warning and/or error.
- Does it do something different than what you expected? If so, what did it do and what did you expect it to do?
- Did MATLAB crash? If so please send the crash log file (with a description of what you were running or doing in MATLAB when the crash occured) to Technical Support so we can investigate.
Star Strider
le 13 Août 2023
@Steven Lord — The Error messages had to do with the missing functions. Supplying them helped, however there were still errors in the code that I wouldn’t have expected to see in a MathWorks Blog post. I detailed them in my Comment.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Wireless Communications dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




