%Example 4.2
%Find the distance to the horizon
%Define the height of the mountains
%  in meters
clear, clc
format bank
%Define the height vector
h=0:1000:8000;
%Convert meters to km
h=h/1000;
%Define the radii of the Moon and Earth 
radius = [1737 	63778];
%Map the radii and heights onto a 2-D grid
[Radius,H]=meshgrid(radius,h);
%Calculate the distance to the horizon
d=sqrt(H.^2 + 2*H.*Radius)
