⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 normlonlat.m

📁 物流分析工具包。Facility location: Continuous minisum facility location, alternate location-allocation (ALA)
💻 M
字号:
function XY = normlonlat(XY)
%NORMLONLAT Convert longitude and latitude to normal form.
%    XY = normlonlat(XY)
%    XY = n x 2 matrix of longitude-latitude pairs (in decimal degrees)
%
% Normal form: -180 < X <= 180 and -90 <= Y <= 90

% Copyright (c) 1994-2006 by Michael G. Kay
% Matlog Version 9 13-Jan-2006 (http://www.ie.ncsu.edu/kay/matlog)

% Input Error Checking ****************************************************
if size(XY,2) ~= 2, error('XY must be a two column matrix.'), end
% End (Input Error Checking) **********************************************

X = XY(:,1); Y = XY(:,2);

Y = rem(Y,360);
isY = Y > 270;
if any(isY)
   Y(isY) = Y(isY) - 360;
end
isY = Y > 90;
if any(isY)
   X(isY) = X(isY) + 180;
   Y(isY) = 180 - Y(isY);
end
isY = Y < -270;
if any(isY)
   Y(isY) = Y(isY) + 360;
end
isY = Y < -90;
if any(isY)
   X(isY) = X(isY) + 180;
   Y(isY) = -180 - Y(isY);
end

X = rem(X,360);
if any(X > 180)
   X(X > 180) = X(X > 180) - 360;
end
if any(X < -180)
   X(X <= -180) = X(X <= -180) + 360;
end

XY = [X Y];
   
   

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -