Help Understanding Time of Flight Phase Sanitization Algorithm I'm implementing the technique found in this paper: http://front.sjtu.edu.cn/~jinyh/gradCourse/Paper/Wireless/SpotFi%20Decimeter%20Level%20Localization%20Using%20WiFi.pdf

to perform localization.

I've implemented 95% of the technique, but this one short algorithm is giving me problems.



The explanation in pseudocode is very simple but the results I'm obtaining are wildly different than reported in the paper, and I don't think this is just a case of misreporting results.

Notice that to minimize the function in step 1, rho will always go to 0! Which is clearly not right. 

An example of this algorithm being applied in the paper is given here, with the first figure being the unwrapped phase prior to running Algorithm 1 and the second one being the resulting phase.



I can share my code so far for Algorithm 1 but I really think that I'm just missing something pretty essential in the description....
I think it's just a simple line fitting, assume that phase = at + b
then the phase without offset is phase_without_offset = phase - at. I used ployfit function in matlab to implement the algorithm.The following picture is my result.


I guess you are a student from SJTU, the same school with me, i'm also implementing the spotfi, can you tell me your email or qq, i want to talk with you! my email is mrshao at sjtu.edu.cn(please replace at with @).