I want to calculate SIR for a Tran in the center of a circle for each interferer distributed randomly in the circle

1 view (last 30 days)
I'm defining SIR_V2V_S as an open 1xn matrix but not getting SIR_V2V_S for each interferer rather getting value of SIR for last interferer only.
SIR_V2V_S=[]
m=0;
for n=1:length(I_dis_v2v)
m=I_dis_v2v(n);
SIR_V2V_S= (P_V.*(r_v.^(-Eta_V)).*Ch_Fading)./((sum((P_V.*hx.*(m.^(-Eta_V)))))+N0);
end

Answers (1)

Vedant Shah
Vedant Shah on 20 Jun 2025
The Signal-to-Interference Ratio (SIR) needs to be computed for a transmitter (Tx) located at the centre of a circle, with multiple interferers randomly distributed within the circle.
In the provided code, a loop is used to iterate over each interferer, but the variable ‘SIR_V2V_S’ is overwritten in each iteration instead of storing the result for each interferer.
To fix this, the SIR value for each interferer needs to be appended to the SIR_V2V_S array. So, the following line of code
SIR_V2V_S= (P_V.*(r_v.^(-Eta_V)).*Ch_Fading)./((sum((P_V.*hx.*(m.^(-Eta_V)))))+N0);
Should be replaced by:
SIR_V2V_S (end+1) = (P_V.*(r_v.^(-Eta_V)).*Ch_Fading)./((sum((P_V.*hx.*(m.^(-Eta_V)))))+N0);
For more information, please refer to the documentation using the following commands in the MATLAB command line: 
web(fullfile(docroot, " /matlab/ref/end.html"));

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Products


Release

R2016b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!