% Message-ID: <3F68A9FF.78018661@udel.edu> %Piotr, % %Here is a Matlab program to read loopstats files and construct Allan %deviation plots. You can modify it for another language or file format. %The key is in the first while loop. % %Dave % % % This program computes graphical statistics from % loopstat files produced by NTP. % clear all; fid = fopen('loopstats', 'r'); [table, count] = fscanf(fid, '%f %f %f %f %f %f %f'); day = table(1:7:count); sec = table(2:7:count) + (day - day(1)) * 86400; offset = table(3:7:count); freq = table(4:7:count); jitter = table(5:7:count); wander = table(6:7:count); poll = table(7:7:count); y1 = offset; i = 1; d = 16; while length(y1) >= 10 u = diff(y1) / d; v = diff(u); z1(i) = sqrt(mean(v .* v) / 2); m1(i) = d; y1 = y1(1:2:length(y1)); i = i + 1; d = d * 2; end loglog(m1, z1 * 1e6, '-k') axis([1 1e5 1e-4 100]); xlabel('Time Interval (s)'); ylabel('Allan Deviation (PPM)'); pause