a=sqrt(2); % slope of g=af curve;
A=log(a)/log(2);%A=1/2; % slope of F=AQ curve; g=af; a=sqrt(2) so A=log2(a)=1/2
Q=linspace(-3,3,6000);
F=1/2/pi*sin(2*pi*Q) + A*Q; % sine plus slope
q=2..^Q;
f=2..^F;
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);
axis(); % set axis to "normal"
plot(q,f,qintegers,fintegers,'+',qintegers,fintegers,"*",qtrue,ftrue)
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)')
plot(Q,F,Qintegers,Fintegers,'+',Qintegers,Fintegers,"*",Qtrue,Ftrue)
subplot(233); % Periodizer is the derivative
xlabel('Q')
ylabel('dF/dQ')
%%%axis([-3 3 -4 3])
Qt=Q(1:length(Q)-1); % Qtruncated
dFdQ=1000*diff(F);
dFintegers=1/2*ones(size(Qintegers));
x=[-3 3]; y=[1/2 1/2];
plot(Qt,dFdQ,Qintegers,dFintegers,'+',Qintegers,dFintegers,'*',x,y)
subplot(111);

