The fopturns function generates a flight path including turns path for given waypoints.
[lati,loni] = fopturns(lat,lon,turns) [xi,yi] = fopturns(x,y,turns) [...] = fopturns(...,'radius',TurningRadius_m) [...] = fopturns(...,'spacing',AlongTrackSpacing_m) [...,di,dwp] = fopturns(...) fopturns
[lati,loni] = fopturns(lat,lon,turns) returns densified coordinates for a flight given the waypoints lat,lon. Coordinates lat,lon can be decimal degrees or in a two-column form [latdeg latmin],[londeg lonmin]. Turn types are specified by a vector turns corresponding to the number of waypoints. To specify a ~270 degree turn at the third waypoint, set turns(3)=270. To begin a ~180 degree turn from waypoint 5 to waypoint 6, set turns(5) = 180. The function will automatically determine the direction of the turn.
[xi,yi] = fopturns(x,y,turns) specifies waypoints in ps71 coordinates. Output coordinates are always in the same units as the input coordinates.
[...] = fopturns(...,'radius',TurningRadius_m) specifies a turning radius of the aircraft in meters. Default turning radius is 5000 m.
[...] = fopturns(...,'spacing',AlongTrackSpacing_m) specifies an along-track spacing for outputs xi,yi in meters. Default spacing is 500 m.
[...,di,dwp] = fopturns(...) also returns a vector of distance along track di which can be useful for plotting elevation profiles or estimating flight times. The optional dwp output is a two-column matrix containing the distance along track to each waypoint. The first column contains wapypoint numbers and the second column contains flight distance to that waypoint. Every 270 degree turn passes its waypoint twice--once before the loop and once after the loop. Thus, dwp will have a length equal to the number of waypoints plus the number of 270 turns.
fopturns(...) without any outputs prints total fight distance in the Command Window.
Given these ps71 coordinates:
x = [-1063266 -970737 -1215679 -1180454 -935503 -909082 -1012026 -1063266]; y = [-431445 -601644 -1057500 -1076443 -620578 -634782 -826374 -431445]; plot(x,y,'w.') text(x(1:7),y(1:7),num2str((1:7)'),... 'horiz','center','vert','middle',... 'fontsize',20,'fontweight','bold') hold on box off axis equal xlabel 'easting (m)' ylabel 'northing (m)'
Make waypoints 3 & 4 270 degree turns, begin a 180 degree turn at waypoint 5, and do another big loopy turn at waypoint 7. Note: even though the big loopy turn at waypoint 7 is more than a 170 degree turn, we still call it a 270.
turns = [0 0 270 270 180 0 270 0]; [xi,yi] = fopturns(x,y,turns); plot(xi,yi,'b.')
Zoom in on those 270 turns:
axis([-1236553 -1165209 -1098079 -1041809])
Zoom in on the 180 turn starting at waypoing 5:
axis([-950659 -899969 -645979 -605999])
As a fun exercise to try at home, repeat Example 1 with these types of turns:
turns = [0 270 270 270 270 270 270 0]; turns = [0 0 0 0 0 0 0 0]; turns = [0 0 180 0 180 0 0 0];
For a quick check of total flight distance use fopturns without writing any output variables. For example, calculate the straight-line distance for the waypoints from Example 1:
Total flight distance: 1914 km (1034 nmi).
How much extra flight distance will a couple of 270 turns add?
fopturns(x,y,[0 0 270 270 0 0 0 0])
Total flight distance: 1982 km (1070 nmi).
Looks like those two turns add about 68 km to the flight assuming the default 5 km turning radius.
Exercising all the options here. We'll use the same waypoints as in Example 1, but we'll enter them as decimal degrees. We'll specify an aircraft turning radius of 8.5 km and get coordinates every 200 m along track.
[lat,lon] = ps2ll(x,y); turns = [0 0 180 0 180 0 270 0];
Plot the straight-line track in geo coordinates:
figure modismoa(mean(lat),mean(lon),900,'inset','northwest','contrast','vlc') plotm(lat,lon,'color',[.58 .82 .99])
Calculate the path with turns and plot:
[lati,loni,d,dwp] = fopturns(lat,lon,turns,'radius',8500,'spacing',200); plotm(lati,loni,'g','linewidth',1)
Now create an elevation profile. Start by geting Bedmap2 surface elevations along track:
z = bedmap2_interp(lati,loni,'surface');
Plot elevation as a function of distance along the flight path:
figure plot(d/1000,z,'linewidth',2) xlabel 'distance along flight (km)' ylabel 'surface elevation (m)' box off; hold on; axis([-100 2100 800 2500])
zwp = 2300*ones(length(dwp),1); plot(dwp(:,2)/1000,zwp,'k+') text(dwp(:,2)/1000,zwp,num2str(dwp(:,1)),'vert','bottom','horiz','center')
Note: Waypoint 7 is passed twice--once going into the 270 turn and once coming out.
Chad A. Greene wrote the fopturns function and supporting documentation in November 2015.