Code covered by the BSD License  

Highlights from
Stability Analyzer 53230A

image thumbnail

Stability Analyzer 53230A

by

 

04 May 2011 (Updated )

The Stability Analyzer 53230A provides Allan or Hadamard Deviation calculations and plotting.

calculateAvgArray(tau, sPeriod, readings)
function [avgArray] = calculateAvgArray(tau, sPeriod, readings)
%This function uses raw readings and returns an array of readings for the
%input Tau argument. readings can either be freq or time

avgCount = tau / sPeriod; %gets count for averaging
loopCount = numel(readings) / avgCount; %get number of loop iterations needed
loopCount = floor(loopCount); %convert loopCount to integer in case it is a non int

avgArray = zeros(1,loopCount); %allocate array
iter = 0;
iter = int32(iter);

%loop to build array
for i = 1:loopCount
    temp = mean(readings((iter+1):(iter+avgCount)));
    avgArray(i) = temp;
    iter = iter + avgCount;
end

Contact us