Blame view

src/g_rect/g_error_polyfit.m 407 Bytes
56902974   Daniel Bourgault   Important changes...
1
function err = g_error_polyfit(cv,lonlon,latlat,err_ll,order);
7d7ce63d   Daniel Bourgault   First commit
2

56902974   Daniel Bourgault   Important changes...
3
4
n_gcp = length(err_ll);
err   = 0;
7d7ce63d   Daniel Bourgault   First commit
5

56902974   Daniel Bourgault   Important changes...
6
for k = 1:n_gcp
7d7ce63d   Daniel Bourgault   First commit
7
8
9
10
11
12
13
14
15
16
17
18
19
20

  if order == 1
      
    efit = cv(1)*lonlon(k)+cv(2)*latlat(k)+cv(3);  
    
  elseif order == 2
      
    efit = cv(1)*lonlon(k)^2+cv(2)*latlat(k)^2+cv(3)*lonlon(k)*latlat(k)+cv(4)*lonlon(k)+cv(5)*latlat(k)+cv(6);
    
  end
  
  err = err + (efit-err_ll(k))^2;

end