www.gusucode.com > map 案例源码 matlab代码程序 > map/ComputeSurfaceAreaVisibleByRadarExample.m

    %% Compute Surface Area Visible By Radar
% Compute the surface area visible by radar from an aircraft flying 3000
% meters above the Yellow Sea. Assume that radio wave propagation in the
% atmosphere can be modeled as straight lines on a 4/3 radius Earth. This
% example also calculates the area visible to the plane above it at 5000
% meters.
%%
% Load data from the MAT-file containing information about the Korean
% peninsula, calculate the viewshed, and display it.

% Copyright 2015 The MathWorks, Inc.

load korea
map(map<0) = -1;
figure
worldmap(map,refvec)
setm(gca,'geoid',[1 0])
da = daspect;
pba = pbaspect;
da(3) = 7.5*pba(3)/da(3);
daspect(da);
demcmap(map)
camlight(90,5);
camlight(0,5);
lighting gouraud
material([0.25 0.8 0])
lat = 34.0931; lon = 125.6578; 
altobs = 3000; alttarg = 0;
plotm(lat,lon,'wo')
Re = earthRadius('meters');
[vmap,vmapl] = viewshed( ...
   map,refvec,lat,lon,altobs,alttarg, ...
   'MSL','AGL',Re,4/3*Re);
meshm(vmap,vmapl,size(map),map)
%%
% Display the visible areas as blue and the obscured areas as red and drape
% the visibility colors on an elevation map, using lighting to bring out
% the surface topography. The aircraft's radar can see out a certain radius
% on the surface of the ocean, but note how some ocean areas are shadowed
% by the island of Jeju-Do. Also some mountain valleys closer than the
% ocean horizon are obscured, while some mountain tops further away are
% visible.
caxis auto; colormap([1 0 0; 0 0 1])
lighting gouraud; 
axis off
%%
% Now calculate the area that the radar plane flying at an altitude of 3000
% meters can have line-of-sight to other aircraft flying above it at 5000
% meters. Note how the area is much larger but that some edges of the area
% are reduced by shadowing from Jeju-Do and the mountains on the Korean
% peninsula.
[vmap,vmapl] = viewshed(map,refvec,lat,lon,3000,5000, ...
               'MSL','MSL',Re,4/3*Re);
clmo surface
meshm(vmap,vmapl,size(map),map)
lighting gouraud