Hallo all, In the meantime I had to refresh my knowledge about state-space representation and Kalman filters, since it was quite a while ago since I had this topic.
So I looked at the equations of the Kalman filter. To my understanding, we can use it like an observer, and instead of using the phase error and feeding it to the PI controller, we use the output of the Kalman filter as input to the PI controller. And the Kalman filter gets its input from the phase error, but we also tell it how much variance this phase error has. Luckily, the GPS module outputs an estimate of the timing accuracy, so I believe one could use this (after squaring) as the estimate of the timing variance, correct? I believe depending on how we model the VCO, we can get away with a scalar Kalman filter and circumvent the matrix and vector operations. I tried to simulate it in Matlab, and it kind of worked, but I noticed some strange effects. a) I made a very simple VCO model, that simulates the phase error. It is x[k+1] = x[k] + KVCO * u with u being the DAC code. If KVCO is chosen correctly, this perfectly models the phase measurements. I assumed the process noise is zero, and the 1PPS jitter contributes only to the measurement noise. b) from the above model, we have a very simple state space model, if you want to call it like this. We have A = 1, B=KVCO, C=1, D=0. c) in the "prediction phase" for the Kalman filter, the error covariance (in this case, the error variance, actually) is P_new=APA' + Q, which reduces in this case to P_new=P+Q with Q being the process noise variance, which I believe is negligible in this case. d) in the "update phase" of the Kalman filter, we find the Kalman gain as K=P*C*inv(C'*P*C + R), and this reduces, as everything is scalar and C=1, to K=P/(P+R), with R being the measurement noise, which, I believe, is equal to the timing accuracy estimate of the GPS module. Correct? we then update the model xhat = A*xhat + b*u + K*(y-c*xhat), which simplifies to xhat=xhat + Kvco*u + K*(y-xhat). Nothing special so far. e) now comes my weird observation. I don't know whether this is correct. The error covariance is now updated according to P=(I-K*C)*P, this breaks down to P=P-K*P. I now observe that P behaves very odd, first we set P=P+Q, and then we set P=P-K*P. It does not really converge in my Matlab Simulation, and I see that the noise is filtered somewhat, but not very good. It could also be related to my variances not being correctly set, I am not sure. Or I made some mistakes with the equations. Any hints? As soon as I see it sort of working in Matlab, I want to test it on my GPSDO. Especially the fact that I have an estimate of the timing error (the GPS module announces this value via a special telegram!) I find very amazing and hope I can make use of this. best Tobias HB9FSX On Tue, Apr 12, 2022 at 11:23 PM glen english LIST <[email protected]> wrote: > For isolating noise, (for the purpose of off line analysis) , using ICA > (Independent Component Analysis) , a kind of blind source separation , > can assist parting out the various noises to assist understanding the > system better . There are some Python primers around for it. > > fantastic discussion going on here. love it. > > glen > > > On 12/04/2022 6:42 pm, Markus Kleinhenz via time-nuts wrote: > > Hi Tobias, > > > > Am 11.04.2022 um 13:33 schrieb Pluess, Tobias via tim > _______________________________________________ > time-nuts mailing list -- [email protected] -- To unsubscribe send > an email to [email protected] > To unsubscribe, go to and follow the instructions there. _______________________________________________ time-nuts mailing list -- [email protected] -- To unsubscribe send an email to [email protected] To unsubscribe, go to and follow the instructions there.
