run /users/swinkels/deploy/MatlabVirgoTools/trunk/startup.m g = utc2gps(2018,4,6,8,10,0); dur = 10*60; phi_chan = 'DAQ_LNFS_6MHz_phi'; freq_chan = 'INJ_LNFS_FREQ1'; freq_nom = 6270777; [phi, t] = getChannel(phi_chan, g, dur); [freq, tt] = getChannel(freq_chan, g, dur); %% dt = t(2) - t(1); dphi_wrap = diff(phi); dphi_wrap = [dphi_wrap(1); dphi_wrap]; % add extra sample for plotting dphi = dphi_wrap - 2*pi*round(dphi_wrap / (2*pi)); freq_meas = -dphi / (dt * 2 * pi); %% plot(t, phi) %% plot(t, dphi_wrap) %% plot(t, dphi) %% n = 1000; plot(t, freq_meas, ... % t(1:n:end), blockaver(freq_meas, n), ... tt, freq - freq_nom); ylim([min(freq_meas)-1, max(freq_meas)+1]) xlabel(sprintf('Time (s) after %s', gps2str(g))) ylabel(sprintf('Frequency deviation (Hz)')) legend({sprintf('measured frequency using diff(%s)', phi_chan),... sprintf('%s - %i', freq_chan, freq_nom)}, 'interpreter', 'none')