-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcomputeGD.m
28 lines (19 loc) · 1.01 KB
/
computeGD.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
function Ang_Step = computeGD(A, E, Rj, hj, dAB, gammaA, gammaJ, channelParam, alphN, Angle,n, nUAV, typeA )
% n: time step
% tht: current theta value
%dTht = (5e-3)*Angle; % Infinitesimal approximation for derivative
dTht = (5e-2)*Angle; % Infinitesimal approximation for derivative
UAVs_FD = setNewPos_N(nUAV, Angle+dTht, hj, Rj, typeA);
UAVs_F = setNewPos_N(nUAV, Angle, hj, Rj, typeA);
% WSC_FD = computeWSC_NSMRT_NUAV(A, E, UAVs_FD, dAB, gammaA, gammaJ, channelParam );
% WSC_F = computeWSC_NSMRT_NUAV(A, E, UAVs_F, dAB, gammaA, gammaJ, channelParam );
WSC_FD = computeWSC_ZF_NUAV(A, E, UAVs_FD, dAB, gammaA, gammaJ, channelParam );
WSC_F = computeWSC_ZF_NUAV(A, E, UAVs_F, dAB, gammaA, gammaJ, channelParam );
WSC_DEV = real((WSC_FD-WSC_F)/dTht);
if alphN==0
alphN = 1/n;
end
%alphN = 1/n;
Ang_Step = Angle - alphN*WSC_DEV;
Ang_Step = mod(Ang_Step,2*pi); % Angle
end