Thursday, December 25, 2008
After posting the previous, I was going over the Kalman filter again, and realized that I had completely borked the math.
I had laboriously moved all the temperature calculation into log space because I couldn't see a way to write the matrix for the temperature decay as a function of temperature.
Silly me. I didn't need to write it as a function of time, but as a function of dt (the time interval). Which makes exponential decay all nice and linear. Doh!
So stripping all the log conversion out make it much simpler to understand and debug.
And then because I was getting bored tweaking PID constants, I wrote a trivial hill-climber in perl to search for good values. After running a few minutes that had reached the solution above.
Looks pretty to good to me! I still think I can get tighter fit to the measured temp (Red line) if I wrote a LQR but I currently fail as finding a good resource that explains how it works. ('explains' means "without going into Laplace transforms which are totally gone from my brain").
(Hmm. How can I attach text files et al to blogger posts?)