Facebook
From Queen Parakeet, 9 Years ago, written in Matlab M-file.
Embed
Download Paste or View Raw
Hits: 762
  1. function [fi,la,h] = hirvonen(x,y,z,a,e2)
  2. i=1;    
  3. p=sqrt(x^2+y^2);
  4. B1 =atan(z/(p*(1-e2)));
  5. etykieta = 0;
  6.  
  7. while etykieta < 1
  8.     if i ~= 1
  9.         B1 = B2;
  10.     end;
  11.        
  12.     N = a/(sqrt(1-e2*sin(B1)^2));
  13.     H = (p/cos(B1))-N;
  14.     B2 = atan((z/p)*(1-(e2*(N/(N+H))))^(-1));
  15.     if abs(B2-B1)<(0.000005/206265) etykieta = 1;  end;
  16.     i = i+1;
  17. end;
  18.  
  19. N = a/(sqrt(1 - e2 * sin(B2) ^ 2));
  20. fi = B2;
  21. h = p/cos(B2) - N;
  22. la = atan(y/x);
  23.  
  24. if la <0
  25.     la = la + pi;
  26. end;
  27.  
  28. h = roundn(h, -3);