%test for equality of two transforms (discrete and continous)
close all
clear all
imax=2^12;
x=1:imax;
wave= exp(-(x-max(x)/2).^2/800)+0.5*exp(-(x-max(x)/2.1).^2/3200);
ft=fft(wave);
angl=angle(ft);
rho=abs(ft);
t0=1;
step=4;
%profH=repmat(rho,[1,1000]).*cos(2*pi*repmat((1:2000)'*(25.6459/2100),[1,1000]).*repmat((t0+step*(0:999)),[length(rho),1])-repmat(angl,[1,1000]));
Nbig=imax/4;
profH=-repmat(rho',[1,Nbig]).*cos(2*pi*repmat((1:imax)'/(imax),[1,Nbig]).*repmat((t0+step*(0:(Nbig-1))),[imax,1])+repmat(angl',[1,Nbig]))/(imax);
prof2=sum(profH);
prof3=real(ifft(rho.*exp(1i.*angl)));
plot(step:step:imax,prof2,'g','linew',2)
hold on
plot(prof3,'r','linew',2)
hold on
plot(wave,'k')