**INPUT DATA**

%#control animation speed DELAY =0.1;num =1000; num1=500 %# create data x =linspace( pi,pi,num); c =linspace(-4,-pi,num1) e =linspace(pi,6,num1) y=(sin(x+1.5))-

```
s=(sin(x+1.5))+1.5d=zeros(1,num1) for k=1:num1 d(1,k) = 0.5-
```
end

```
f=zeros(1,num1) for l=1:num1 f(1,l) = 0.5 end-
```
%# plot graph

plot(x,y,x,s,c,d,e,f ),xlabel('x'), ylabel('y'), title('Flight Path'),grid on %# create moving point + coords text

hLine = line('XData',x(1), 'YData',s(1), 'Color','r', ...-

'Marker','^', 'MarkerSize',15, 'LineWidth',2);-

hTxt = text(x(1), s(1), sprintf('(%.3f,%.3f)',x(1),y(1)), ...-

'Color','r', 'FontSize',10, ...-

 'HorizontalAlignment','left', 'VerticalAlignment','top');-

hLine1 = line('XData',c(1), 'YData',d(1), 'Color','r', ...-

'Marker','^', 'MarkerSize',15, 'LineWidth',2);-

hTxt1 = text(c(1), d(1), sprintf('(%.3f,%.3f)',c(1),d(1)), ...-

'Color','r', 'FontSize',10, ...-

'HorizontalAlignment','left', 'VerticalAlignment','top');-

hLine2 = line('XData',e(1), 'YData',f(1), 'Color','r', ...-

'Marker','^', 'MarkerSize',15, 'LineWidth',2);-

hTxt2 = text(e(1), f(1), sprintf('(%.3f,%.3f)',e(1),f(1)), ...-

'Color','r', 'FontSize',10, ...-

'HorizontalAlignment','left', 'VerticalAlignment','top');-

for j=1:length(c)-

```
disp('WARNING!! TERRAIN TERRAIN PULL UP!!') set(hLine1, 'XData',c(j), 'YData',d(j))-
```
set(hTxt1, 'Position',[c(j) d(j)], ...-

'String',sprintf('(%.3f,%.3f)',[c(j)d])) drawnow-

j= rem(j+1,num1)+1;-

if ~ishandle(hLine), end end

```
fori=1:length(x) set(hLine, 'XData',x(i), 'YData',s(i)) set(hTxt, 'Position',[x(i) s(i)], ...-
```

```
'String',sprintf('(%.3f,%.3f)',[x(i) s(i)]))-
```
drawnow

i = rem(i+1,num)+1; if ~ishandle(hLine), end end-

```
for n=1:length(e) disp('NO WARNING')-

set(hLine2, 'XData',e(n), 'YData',f(n)) set(hTxt2, 'Position',[e(n) f(n)], ...-

'String',sprintf('(%.3f,%.3f)',[e(n) f(n)])) draw now-

n= rem(n+1,num1)+1; if ~ishandle(hLine2),-

end end
```