%%Prevedeni souradnicoveho systemu z WGS84 do ECEF
function [X,Y,Z] = WGS2ECEF (lat,long,h)

%parametry elipsoidu pro ECEF
a=6378137;          %hlavni poloosa
f=1/298.257223563;  %zplosteni
e=0.081819190842622 %excentricita

%prevedeni na radiany
fi=lat.*pi./180;
lamda=long.*pi./180;

%vypocet
N=a./(1-e^2.*((sin(fi)).^2));   %polomer krivosti

X=(N+h).*cos(fi).*cos(lamda);   %souradnice X
Y=(N+h).*cos(fi).*sin(lamda);   %souradnice Y
Z=(N.*(1-e^2)+h).*sin(fi);      %souradnice Z
end