%solve the linear Schroedinger
lin_schrod_no_potential;  %set all parameters inside that program
%%

%study the Fourier components of the solution along (or near) rays of a given speed

speed = 3; %choose the speed of your ray
dominant_k= speed/2;
ray_location = speed*t; 
cut_ind = find(x>ray_location-30& x<ray_location+30);
utmp =zeros(size(u));
utmp(cut_ind)=u(cut_ind);
cut_fft = fft(utmp);

dominant_k_num = (2*pi/L)*find(abs(cut_fft)==max(abs(cut_fft)));
[dominant_k dominant_k_num]


figure;
plot((2*pi/L)*[0:N/2],abs(cut_fft(1:N/2+1)))
hold on
ax=axis;
plot(dominant_k*ones(1,5),linspace(ax(3),ax(4),5),'r','linewidth',2)
xlabel('$$k$$','interpreter','latex','fontsize',14)
ylabel('$$|\hat{u}(k,t)|$$','interpreter','latex','fontsize',14)