MATLAB: Do the UTM WGS84 calculations not match what MATLAB has calculated

Mapping Toolbox

I have longitude and latitude data and I have converted them to UTM using WGS 84 standards. When I compare these to the UTM values generated from my lat and long they do not match. Default values for my conversion are from
<http://www.cellspark.com/UTM.html>
For example:
test=defaultm('utm');
utmzone=35;
origin=(utmzone-31).*6+3;
test.origin=[0 origin 0];
test=defaultm(test);
[eastutm2,northutm2]=mfwdtran(test,44.3536,28.4981);
%default values taken from manual lat -> UTM conversion
diffnorth2=4912239-northutm2
diffeast2=619393.56-eastutm2

Best Answer

This difference occurs because MATLAB’s default reference ellipsoid is "International", not "WGS 84"
Although people often use UTM with WGS 84, UTM was originally specified to work the various ellipsoids in different parts of the world, and the toolbox honors this specification.
The following code is accurate to within a few centimeters.
mUtm=defaultm('utm');
mUtm.zone = '35T';
mUtm.geoid = almanac('earth','wgs84','meters');
mUtm=defaultm(mUtm);
[eastutm2,northutm2]=mfwdtran(mUtm,44.3536,28.4981);
%default values taken from manual lat -> UTM conversion
diffnorth2=4912239-northutm2
diffeast2=619393.56-eastutm2
% Perform inverse mapping to verify lat and lon
[lat, lon] = minvtran(mUtm, eastutm2,northutm2)
Note that starting in MATLAB 7.14 (R2012a), it is recommended to use the wgs84Ellipsoid function instead of almanac . To do so, replace the line containing the almanac function with the following:
mUtm.geoid = wgs84Ellipsoid('meters');