%this function finds the azimuth angle of the path and returns it,
%calculates fastest going up from 1 to ymax, while x goes from 1 to xmax
function [theta] = find_angle(dx,dy)
if(dx < 0)
    theta = 270-atan(dy/dx)*180/pi;
elseif(dx > 0)
    theta = 90-atan(dy/dx)*180/pi;
elseif((dx == 0) && (dy ~= 0))
    theta = 90-dy/abs(dy)*90;
else
    theta = 'error: dx and dy are zero';
end