% Plotting dispersion relation (plots maximum two curves)

clear all
close all

    
inp= 'unb_B';                        % The oscillation amplitude
pr= '23';
gg= '';
dt= 1.e-12;

%%%%%%%% Names %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

nmp= strcat(inp,'.inp.dat_npd.',pr,gg);
vout=strcat(inp,'_fw_',pr,'.txt');
dd= load(nmp); 

%%%%%%%% PLOTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

sz= size(dd,1);
Y= fft(dd);
P2 = abs(Y/sz);
P1 = P2(1:sz/2+1);
P1(2:end-1) = 2*P1(2:end-1);

gg= (0:(sz/2))/sz./dt;
fw(:,1)= gg(1,:);  
fw(:,2)= P1(:,1);

plot(fw(:,1)*1e-9*2*pi,fw(:,2))

    xlabel('v [GHz]')
    ylabel('Oscillation amplitude')
    axis tight
    
save(vout,'fw','-ascii');
    
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%