a=sqrt(2); % slope of g=af curve;
f=[1../a/a/a*f1cycle_sqrt(125) 1../a/a*f1cycle_sqrt(250) 1../a*f1cycle_sqrt(500) f1cycle_sqrt(1000) a*f1cycle_sqrt(2000) a*a*f1cycle_sqrt(4000)];
q=(125:7999)/1000;
grid
gset nokey
xlabel('q')
ylabel('f(q)')
%plot(q,f)
qintegers=[1/8 1/4 1/2 1 2 4 8];
fintegers=[1/a/a/a 1/a/a 1/a 1 a a*a a*a*a];
qtrue=(0:7999)/1000; % ok for linear plot, but problem for loglog plot
ftrue=sqrt(qtrue);
subplot(231);
plot(q,f,qintegers,fintegers,'+',qintegers,fintegers,"*",qtrue,ftrue,".")
Q=log(q)/log(2);
F=log(f)/log(2);
Qintegers=log(qintegers)/log(2);
Fintegers=log(fintegers)/log(2);
Qtrue=log(q)/log(2); % log plot problem because it goes to zero
ftrue=sqrt(q);
Ftrue=log(ftrue)/log(2);
subplot(232);
xlabel('Q')
ylabel('F(Q)')
title('Comperiodicity')
plot(Q,F,Qintegers,Fintegers,'+',Qintegers,Fintegers,"*",Qtrue,Ftrue,".")

% redraw previous plot on a uniformly sampled lattice
funiform=1+sin(   2*pi*2..^((0:999)./1000)   ); % 1 cycle
%%aq=1/2*(0:999)/1000;
aq=1/2*(0:999)/1205;
funiform=funiform+aq;
Funiform=log(funiform)/log(2);
Funiforms=[Funiform-3/2 Funiform-1 Funiform-1/2 Funiform Funiform+1/2 Funiform+1];
subplot(233);
xlabel('Q')
ylabel('dF(Q)/dQ')
%domain=linspace(-3,3,length(Funiforms));
%domain=linspace(-3,3,length(Funiforms)-1);
%plot(domain,Funiforms);
plot(linspace(-3,3,length(Funiforms)-1),1000*diff(Funiforms),[-3,3],[1/2,1/2]);

subplot(111);

