www.gusucode.com > phased 案例源码 matlab代码程序 > phased/PlotPolarizationLossReceiverAntennaRotationExample.m

    %% Plot Polarization Loss as Receiving Antenna Rotates  
% Specifying identical transmitter and receiver polarizations, plot the loss
% as the local receiving antenna axes rotate around the $x$-axis.   

% Copyright 2015 The MathWorks, Inc.


%%  
fv_tr = [1;0];
fv_rcv = [1;0];  

%% 
% The position of the transmitting antenna is at the origin and its local
% axes align with the global coordinate system. The position of the receiving
% antenna is 100 meters along the global $x$-axis. However, its local $x$-axis
% points towards the transmitting antenna. 
pos_tr = [0;0;0];
axes_tr = azelaxes(0,0);
pos_rcv = [100;0;0];
axes_rcv0 = rotz(180)*azelaxes(0,0);  

%% 
% Rotate the receiving antenna around its local $x$-axis in one-degree increments.
% Compute the loss for each angle. 
angles = [0:1:359];
n = size(angles,2);
rho = zeros(1,n); % Initialize space
for k = 1:n
    axes_rcv = rotx(angles(k))*axes_rcv0;
    rho(k) = polloss(fv_tr,fv_rcv,pos_tr,axes_tr,...
        pos_rcv,axes_rcv);
end  

%%
% Plot the polarization loss.
hp = plot(angles,rho);
hax = hp.Parent;
hax.XLim = [0,360];
xticks = (0:(n-1))*45;
hax.XTick = xticks;
grid;
title('Polarization loss versus receiving antenna rotation')
xlabel('Rotation angle (degrees)');
ylabel('Loss (dB)');    

%%
% The angle-loss plot shows nulls (|Inf| dB) at 90 degrees and 270 degrees where the polarizations
% are orthogonal.