SINR calculation for UAV
조회 수: 2 (최근 30일)
이전 댓글 표시
I am very new to using Matlab. so far I've deployed UAV,UE and created channel model. I'm stuck calculating sinr. I'm sure I implemented phase 1 and 2 wrong cuz I keep getting error. Here I do not consider linear beamforming technique as in the paper, just calc snr between MBS-UAV and sinr between UAV-UE. Can someone help me fix my implementation, please?
function RL = fun_sinr(env,RL)
RL.sinr = zeros(env.numUE,env.numFreq);
RL.snr = zeros(env.numUAV,env.numFreq);
RL.rate = zeros(env.numUE,1);
RL.rateBH = zeros(env.numUAV,1);
% MBS-UAV backhaul
signal = env.powerMBS.*reshape(RL.alpha_GtA(:,1,:),env.numUAV,env.numFreq).*RL.freqMBS(2:end,:);
for i = 1:env.numUAV
RL.snr(i,:) = signal(i,:) ./ env.noise;
end
RL.s = signal;
RL.ii = [];
% UAV-UE access
for i = 2:env.numUE
ueCh = env.powerUAV.*reshape(RL.alpha_AtG(i,2:end,:),env.numUAV,env.numFreq).*RL.freqUAV;
crossInter = env.powerMBS.*reshape(RL.alpha_AtG(i,1,:),1,env.numFreq).*sum(RL.freqMBS,1);
RL.sinr(i,:) = ueCh(i-1,:) ./ (sum(ueCh([1:i-2 i:end],:),1) + crossInter + env.noise);
RL.ii = [RL.ii; sum(ueCh([1:i-2 i:end],:),1) + crossInter];
end
RL.rateAcc = log2(1+RL.sinr);
RL.rateBH = log2(1+RL.snr);
RL.accRate = sum(RL.rate,2);
RL.bhRate = sum(RL.rateBH,2);
RL.rate = RL.accRate;
RL.rate(2:end,1) = min(RL.rate(2:end,1),RL.bhRate);
RL.rate = RL.rate./10^6;
end
댓글 수: 0
답변 (1개)
Aishwarya Shukla
2023년 3월 30일
It's difficult to debug your code without seeing the error message that you're getting. However, I can provide some general feedback on your code.
The variable ueCh is computed as follows:
ueCh = env.powerUAV.*reshape(RL.alpha_AtG(i,2:end,:),env.numUAV,env.numFreq).*RL.freqUAV;
This seems to assume that the UAV is transmitting to the UE, but in the next line, you use ueCh(i-1,:) as the signal power, which doesn't seem to make sense.
The variable crossInter is computed as follows:
crossInter = env.powerMBS.*reshape(RL.alpha_AtG(i,1,:),1,env.numFreq).*sum(RL.freqMBS,1);
This seems to assume that the MBS is transmitting to the UE, but in the previous line, you used ueCh to compute the signal power. You need to make sure that you're computing the interference power correctly.
The variable RL.rate is computed as follows:
RL.rate = sum(RL.rate,2);
RL.rate(2:end,1) = min(RL.rate(2:end,1),RL.bhRate);
This seems to assume that RL.rate is a 2D matrix, but it's actually a 1D vector. You should remove the sum function call.
Overall, I would recommend going through your code carefully and double-checking that you're using the correct variables and that you're computing the signal and interference powers correctly. You might also want to add some print statements to help with debugging.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Array Geometries and Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!