Commit e70023e3f935e21ba56af7703805440531958687

Authored by Elie Dumas-Lefebvre
Committed by Elie Dumas-Lefebvre
1 parent 5934cd22
Exists in master

Version matricielle de la resolution (combinaison de g_res et de g_dist en un)

Showing 1 changed file with 34 additions and 0 deletions   Show diff stats
src/g_rect/g_res_field.m 0 → 100644
... ... @@ -0,0 +1,34 @@
  1 +function delta = g_res_field(LAT, LON)
  2 +
  3 +% LAT and LON difference in the x-axis
  4 +dLATi = diff(LAT, 1, 2);
  5 +dLONi = diff(LON, 1, 2);
  6 +
  7 +% LAT and LON difference in the y-axis
  8 +dLATj = diff(LAT, 1, 1);
  9 +dLONj = diff(LON, 1, 1);
  10 +
  11 +% Mean LAT in both x and y axis
  12 +LAT_meani = 0.5*(LAT(:, 2:end) + LAT(:, 1:end-1));
  13 +LAT_meanj = 0.5*(LAT(2:end, :) + LAT(1:end-1, :));
  14 +
  15 +% Conversion from degree to meters
  16 +meterPerDegLat = 1852*60.0;
  17 +meterPerDegLoni = meterPerDegLat .* cosd(LAT_meani);
  18 +meterPerDegLonj = meterPerDegLat .* cosd(LAT_meanj);
  19 +
  20 +dxi = dLONi.*meterPerDegLoni;
  21 +dxj = dLONj.*meterPerDegLonj;
  22 +
  23 +dyi = dLATi.*meterPerDegLat;
  24 +dyj = dLATj.*meterPerDegLat;
  25 +
  26 +% Distances in x and y axis
  27 +deltai = sqrt(dxi.^2 + dyi.^2);
  28 +deltaj = sqrt(dxj.^2 + dyj.^2);
  29 +
  30 +% Overall distance
  31 +delta = sqrt(deltai.^2 + deltaj.^2);
  32 +
  33 +end
  34 +
... ...