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

    %% Convert Radiation Pattern Using Specific Phi/Theta Values  
% Convert a radiation pattern to $\phi-\theta$ space with the angles spaced five degrees
% apart.   

% Copyright 2015 The MathWorks, Inc.


%% 
% Define the pattern in terms of $u$ and $v$. For values outside the unit
% circle, $u$ and $v$ are undefined, and the pattern value is 0. 
u = -1:0.01:1;
v = -1:0.01:1;
[u_grid,v_grid] = meshgrid(u,v);
pat_uv = sqrt(1 - u_grid.^2 - v_grid.^2);
pat_uv(hypot(u_grid,v_grid) >= 1) = 0;  

%% 
% Define the set of $\phi$ and $\theta$ angles at which to sample the pattern. Then,
% convert the pattern. 
phi = 0:5:360;
theta = 0:5:90;
pat_phitheta = uv2phithetapat(pat_uv,u,v,phi,theta);  

%% 
% Plot the result. 
H = surf(phi,theta,pat_phitheta);
H.LineStyle = 'none';
xlabel('Phi (degrees)');
ylabel('Theta (degrees)');
zlabel('Pattern');