How can I know the slantRange of a GPS in the aer2ecef function
thanks
That depends on whether you already know where the satellite is, or if you are trying to determine where it is.
If you already know, then subtract the satellite and ground position vectors, and find the magnitude of the difference.
If you're trying to find out, then you need measurements of some kind. A GPS timing-based pseudorange estimate is a decent start, but for precision work needs to be corrected for atmospheric refraction and other small but significant effects. GPS is too far away for easy radar tracking, but if you are also interested in an answer for LEO satellites, radar and laser ranging both work quite well.
https://space.stackexchange.com/questions/17916/ground-longitude-latitude-under-a-satellite-cartesian-coordinates-at-a-specfic#:~:text=Find%20the%20line%20in%20space,and%20longitude%20of%20that%20point.
R=sqrt(1./(tan(gclat).^2/b^2 + 1/a^2));
– TThoye Jan 11 '23 at 17:45