I am trying to calculate the greater circle distance in metres from a source point (specified as a latitude/longitude) to the centre of all grid cells within a domain (or reference grid - calculated using makerefmat).
Would anyone be able to help me with this?
sourcelon = -7.340612;
sourcelat = 57.005755;
DDX = 4800;
DDY = 5760;
latlim = [53.5, 59.5];
lonlim = [-9, -4];
latvec = linspace(latlim(1),latlim(2),DDY);
lonvec = linspace(lonlim(1),lonlim(2),DDX);
dy = abs(latlim(1)-latlim(2))/DDY;
dx = abs(lonlim(1)-lonlim(2))/DDX;
x11 = lonlim(1);
y11 = latlim(1);
R = makerefmat(x11, y11, dx, dy);