Created
August 3, 2023 22:02
-
-
Save kaizhu256/83f9bc54b8d58ebf5b92645186d30000 to your computer and use it in GitHub Desktop.
gauss-newton cosine fit pseudo code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aa = SQRT(SUM((yy - avg)^2) * 2.0 / nn) | |
cos = cosine(pp + ww*tt) | |
sin = sine(pp + ww*tt) | |
rr = (cos - yy) * (cos - yy) | |
hh1 = SUM( sin*sin - rr*cos ) | |
hh2 = SUM(tt * (sin*sin - rr*cos)) | |
hh3 = SUM(tt*tt * (sin*sin - rr*cos)) | |
gg1 = SUM( rr * sin) | |
gg2 = SUM(tt * rr * sin) | |
inv = 1 / (hh1*hh3 - hh2*hh2) | |
delta_pp = inv * (hh3 * gg1 - hh2 * gg2) | |
delta_ww = inv * (hh1 * gg2 - hh2 * gg1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment