\(\(\(\ \)\(\(xcoef = {\(-0.34886499660269998\), 
          4.6217125673580002, \(-0.018878150199139999\), 
          3.9343528897339999, \(-18.808909002309999\), 
          1.8626950805489999, \(-30.38444768414\), 
          6.8114928686649998, \(-15.877931827759999\), \(-2.573471926521\), \(-11.170976745180001\), \(-10.364439758810001\), \(-15.53813792229\), \(-5.0730863744360004\), \(-1.295101136797\), 
          11.85332787001, \(-34.464835789120002\), 
          10.92499362755, \(-1.5876867256280001\), \(-43.27430923659\), 
          4.2986474531649996};\)

    \ \(ycoef = {3.1988213871609998, \(-0.53628296832209998\), 
          4.8333469065349997, \(-9.0237581904360002\), 
          3.159317085973, \(-31.144223702750001\), 
          7.9801061707869998, \(-36.108141866079997\), 
          3.342286215184, \(-24.012619636349999\), 
          1.0428534466120001, \(-10.65374454905\), \(-18.361229846579999\), \(-7.5553521291059997\), \(-0.75982057714569995\), \(-28.098024560590002\), 
          45.120781395480002, \(-12.54763612048\), 
          5.7287233025280004, \(-12.35141092754\), 13.866474231670001};\)

    \)\)\)

\(Ta = 
      Function[{xi, yi}, \ 
fitorder = 5; 

        naxis1 = 2049; 
naxis2 = 2049; w2 = 0.5 \((naxis1 + 1)\); 

        h2 = 0.5 \((naxis2 + 1)\); x = \((\((xi - 1)\) - w2)\)/naxis1; 

        y = \((\((yi - 1)\) - h2)\)/naxis2; 
x1 = 0; 
y1 = 0; 

        i1 = 1; 
Do[
          Do[i2 = k1 - j; 
x1 = x1 + xcoef[\([i1]\)] x\^i2\ y\^j; 

            y1 = y1 + ycoef[\([i1]\)] x\^i2\ y\^j; 
\(i1++\); {x1, y1}, {j, 
              0, k1}], {k1, 0, fitorder}]]\)

Ta[u, v]

y1

Δx[u_, v_] = -0.3488649966027` + 
          0.0022555942251625185` (-1026.` + u) + 
          9.371074582285018`*^-7 (((-1026.` + u))^2) - 
          3.5320388439352956`*^-9 (((-1026.` + u))^3) - 
          6.337577951240603`*^-13 (((-1026.` + u))^4) + 
          3.2819390049562676`*^-16 (((-1026.` + u))^5) - 
          9.21334807181064`*^-6 (-1026.` + v) - 
          4.480017273793046`*^-6 (-1026.` + u) (-1026.` + 
                v) + 7.918017022198831`*^-10 (((-1026.` + u))^2) (-1026.` + v) - 
          5.880009097748536`*^-13 (((-1026.` + u))^3) (-1026.` + 
                v) - 9.542593448537607`*^-16 (((-1026.` + u))^4) (-1026.` + v) + 4.4366773934862347`*^-7 (((-1026.` + v))^2) - 
          1.8457295179427645`*^-9 (-1026.` + 
                u) (((-1026.` + v))^2) - 
          8.815179061412849`*^-13 (((-1026.` + u))^2) (((-1026.` + v))^2) + 
          3.024902635644783`*^-16 (((-1026.` + u))^3) (((-1026.` + v))^2) - 2.991531359312396`*^-10 (((-1026.` + v))^3) - 
          2.878090348298068`*^-13 (-1026.` + 
                u) (((-1026.` + v))^3) - 
          4.3959730546839565`*^-17 (((-1026.` + u))^2) (((-1026.` + v))^3) - 7.347436662360587`*^-14 (((-1026.` + v))^4) - 
          1.1981752715660279`*^-15 (-1026.` + 
                u) (((-1026.` + v))^4) + 
          1.1902057295481046`*^-16 (((-1026.` + v))^5);

Δy[u_, v_] = 
        3.198821387161` - 
          0.00026172912070380675` (-1026.` + u) - 
          2.1493321363147545`*^-6 (((-1026.` + u))^2) + 
          9.276471064063447`*^-10 (((-1026.` + u))^3) + 
          5.916371648052327`*^-14 (((-1026.` + u))^4) - 
          7.779756350192119`*^-16 (((-1026.` + u))^5) + 
          0.002358880871905808` (-1026.` + v) + 
          7.525048431469506`*^-7 (-1026.` + u) (-1026.` + 
                v) - 4.197389433538772`*^-9 (((-1026.` + u))^2) (-1026.` + v) - 
          6.04413903030832`*^-13 (((-1026.` + u))^3) (-1026.` + 
                v) + 1.2493002304491722`*^-15 (((-1026.` + u))^4) (-1026.` + v) - 7.418115540356913`*^-6 (((-1026.` + v))^2) + 
          3.8852392060236`*^-10 (-1026.` + 
                u) (((-1026.` + v))^2) - 
          1.0416790589377535`*^-12 (((-1026.` + u))^2) (((-1026.` + v))^2) - 
          3.4741784632476136`*^-16 (((-1026.` + u))^3) (((-1026.` + v))^2) - 2.791345960338202`*^-9 (((-1026.` + v))^3) - 
          4.2863425606844183`*^-13 (-1026.` + 
                u) (((-1026.` + v))^3) + 
          1.5861638740912232`*^-16 (((-1026.` + u))^2) (((-1026.` + v))^3) - 4.31065451702353`*^-14 (((-1026.` + v))^4) - 
          3.419847804252326`*^-16 (-1026.` + 
                u) (((-1026.` + v))^4) + 
          3.839337200591615`*^-16 (((-1026.` + v))^5);

SetDirectory["Z:\V2008-03-02"]

Clear[Zvezde]

Zvezde = 
      ReadList["zvezde2.txt", {Number, Number, Number, Number, Number, 
          Number, Number}]

PrviSet = 
      Table[{Zvezde[[i]][[2]], Zvezde[[i]][[3]]}, {i, 
          Length[Zvezde]}]
DrugiSet = 
      Table[{Zvezde[[i]][[5]], Zvezde[[i]][[6]]}, {i, 
          Length[Zvezde]}]

Show[ListPlot[PrviSet], ListPlot[DrugiSet]]

ListPlot[PrviSet - DrugiSet]

DX = 19
DY = -800

PrviPop = 
      Table[{Δx[PrviSet[[i]][[1]] - 
              DX, PrviSet[[i]][[2]] - 
              DY], Δy[PrviSet[[i]][[1]] - 
              DX, PrviSet[[i]][[2]] - DY]}, {i, 
          Length[PrviSet]}]

PremikX = 0 
PremikY = 0

DrugiPop = 
      Table[{Δx[DrugiSet[[i]][[1]] - 
              PremikX, DrugiSet[[i]][[2]] - 
              PremikY], Δy[DrugiSet[[i]][[1]] - 
              PremikX, DrugiSet[[i]][[2]] - PremikY]}, {i, 
          Length[DrugiSet]}]

Ta[PrviSet[[1]][[1]], PrviSet[[1]][[2]]]

Ta[20, 50]

Sl1 = 
      ListPlot[PrviSet + PrviPop - DrugiSet - DrugiPop, 
        PlotRange -> {{-2.5, 2}, {2, 6.5}}, 
        AspectRatio -> 1]

Krog = 
      ParametricPlot[
        Prem + Sigma {Cos[ϕ], Sin[ϕ]}, {ϕ, 0, 
          2  π}]

Show[Sl1, Krog]

Razlika = 
      Table[PrviSet[[i]] + PrviPop[[i]] - DrugiSet[[i]] - 
          DrugiPop[[i]], {i, 33}]

Razlika = {{-0.8516195952968826`, 
          4.964995955393298`}, {-1.2296851370005017`, 
          4.864741739516684`}, {-1.066320312007159`, 
          4.955231877770532`}, {-1.2071462186674295`, 
          4.780490342373243`}, {-1.18316228523649`, 
          4.9812600056165826`}, {-1.0547840374242758`, 
          4.98229578235589`}, {-1.0784731981482558`, 
          4.827707985841068`}, {-1.3090483888118727`, 
          4.660424215298203`}, {-1.3766930250800962`, 
          4.333002504900389`}, {-1.2607615234252554`, 
          4.072064455344438`}, {-1.0240652542697963`, 
          4.337711214438168`}, {-0.9876392729428713`, 
          4.409199908377152`}, {-0.9586842428089228`, 
          4.432863571956174`}, {-1.0079447406128672`, 
          4.5594990372676785`}, {-0.9634767844929637`, 
          4.392599787532369`}, {-0.48898362511248394`, 
          4.618878899688336`}, {-0.9370970650676003`, 
          4.914891966398029`}, {-0.9251961549684766`, 
          5.375017395699716`}, {-1.308791451681246`, 
          4.813407333150213`}, {-1.305534004702473`, 
          4.029968548919855`}, {-1.1066459622227536`, 
          4.183013622616835`}, {-1.1924255757864675`, 
          4.636433411235321`}, {-1.0454069999211164`, 
          4.962254748076143`}, {-1.0747769231947428`, 
          5.1178739875824855`}, {-1.3167753948997127`, 
          4.790754230772255`}, {-0.8589377293703158`, 
          4.360867147000532`}, {-0.9120717355661145`, 
          4.383062160300885`}, {-0.9934758249713809`, 
          4.293488200890677`}, {-0.9117093682659017`, 
          4.283144321000053`}, {-0.978409145212257`, 
          4.304322467834047`}, {-1.010660905297701`, 
          4.427936617096991`}, {-1.0803607980544274`, 
          5.076818371576049`}}

Prem = Sum[Razlika[[i]], {i, 32}]/32
Sigma = (Sqrt[Sum[(Razlika[[i]] - Prem) . (Razlika[[i]] - Prem), {i, 32}]/32])

NovaRazl = Table[Razlika[[i]] - Prem, {i, 33}]

ListPlot[NovaRazl, PlotRange -> All]