% The script file pwsemf04 depicts the correlation functions
% and the spectral densities of the non, once and twice differentiable
% processes.

Tp=1; beta=2*pi/Tp; eta=1/5/Tp; dt=Tp/50; n=300;
TAU=1:300; TAU=TAU'*dt; ETATAU=eta*TAU; BETATAU=beta*TAU;
%[TAU,ETATAU,BETATAU]

C00=exp(-ETATAU).*cos(BETATAU);
C11=(1+ETATAU).*exp(-ETATAU) .*cos(BETATAU);
C22=(1+ETATAU+ETATAU.*ETATAU/3).*exp(-ETATAU) .*cos(BETATAU);

plot(TAU,C00,'k',TAU,C11,'b',TAU,C22,'r')
title('Covariace functions as functions of omega/tau')
pause
close

domega=3*beta/n; OMEGA=0:300; OMEGA=OMEGA'*domega;
AB=ones(size(OMEGA)); AC=1+(OMEGA-beta*AB).*(OMEGA-beta*AB);
AF=AB./AC;
S00=2/eta.*AF;
S11=4/eta.*AF.*AF;
S22=16/3/eta.*AF.*AF.*AF ;

plot(OMEGA,S00,'k',OMEGA,S11,'b',OMEGA,S22,'r')
title('Spectral density as function of omega')
pause 
close

domega=3*beta/n; OMEGA=0:300; OMEGA=OMEGA'*domega;
AB=ones(size(OMEGA)); AC=1+(OMEGA-beta*AB).*(OMEGA-beta*AB);
AF=AB./AC;
S22=16/3/eta.*AF.*AF.*AF ;

AC2=1+(OMEGA-2*beta*AB).*(OMEGA-2*beta*AB);
AF2=AB./AC2;
S222=16/3/eta.*AF2.*AF2.*AF2 ;

plot(OMEGA,S22,'k',OMEGA,S222,'r')
title('Spectral density as function of omega,two frequencies')
pause 
close


