%This program takes a record and outputs the Period, Phase, %Percent Power, and Q value of the harmonic containing the largest variance. %This harmonic is then subtracted from the record and the process repeated. % %function [Period, Percent, Sig, Q] = stat2PH(x, t, num, frange, qplot); % %x = input data %t = time x measuremenst were taken at %num = number of iterations to perform. %frange= frequency space to search over: i.e. 1/800:1/2^14:1/10 or so. %qplot= do you want these things plotted function [A, F, phase, x] = stat2PH(x, t, num, frange, qplot); x=x-mean(x); %dt =.5; %t = 2*pi*[0:dt:100]; %t = sort(rand(1,500)*1000); %x = 2.31*cos(2*pi*t/100+pi*10/180); %+cos(t/41+pi*40/180); %x = x-mean(x); %num = 3; %qplot = 1; for iter=1:num; way=size(x); if way(1)