On 5/2/22 6:09 PM, Magnus Danielson via time-nuts wrote:
Matthias,
On 2022-05-02 17:12, Matthias Welwarsky wrote:
Dear all,
I'm trying to come up with a reasonably simple model for an OCXO that
I can
parametrize to experiment with a GPSDO simulator. For now I have the
following
matlab function that "somewhat" does what I think is reasonable, but
I would
like a reality check.
This is the matlab code:
function [phase] = synth_osc(samples,da,wn,fn)
# aging
phase = (((1:samples)/86400).^2)*da;
# white noise
phase += (rand(1,samples)-0.5)*wn;
# flicker noise
phase += cumsum(rand(1,samples)-0.5)*fn;
end
There are three components in the model, aging, white noise and
flicker noise,
with everything expressed in fractions of seconds.
The first term basically creates a base vector that has a quadratic
aging
function. It can be parametrized e.g. from an OCXO datasheet, daily
aging
given in s/s per day.
The second term models white noise. It's just a random number scaled
to the
desired 1-second uncertainty.
The third term is supposed to model flicker noise. It's basically a
random
walk scaled to the desired magnitude.
<snip>
Another thing. I think the rand function you use will give you a
normal distribution rather than one being Gaussian or at least
pseudo-Gaussian.
rand() gives uniform distribution from [0,1). (Matlab's doc says (0,1),
but I've seen zero, but never seen 1.) What you want is randn(), which
gives a zero mean, unity variance Gaussian distribution.
https://www.mathworks.com/help/matlab/ref/randn.html
A very quick-and-dirty trick to get pseudo-Gaussian noise is to take
12 normal distribution random numbers, subtract them pair-wise and
then add the six pairs.
That would be for uniform distribution. A time-honored approach from the
IBM Scientific Subroutine Package.
The subtraction removes any bias. The 12 samples will create a
normalized deviation of 1.0, but the peak-to-peak limit is limited to
be within +/- 12, so it may not be relevant for all noise
simultations. Another approach is that of Box-Jenkins that creates
much better shape, but comes at some cost in basic processing.
_______________________________________________
time-nuts mailing list -- [email protected] -- To unsubscribe send an
email to [email protected]
To unsubscribe, go to and follow the instructions there.