% file='traject_13.h5'; % %close all hidden; % if (~exist('M','var')) % M.file=file; % end % M=load_espic2d(file,M,'all'); % N=M.Npartscell(:,:,1); % [~,index]=max(N,[],'all','linear'); % [Rindex,Zindex]=ind2sub([70,128],index); Rindex=16; Zindex=64; Rindex=M.nnr(1)+6; Zindex=floor(size(M.zgrid,1)/2); Indices=M.Rindex(:,1)==Rindex & M.Zindex(:,1)==Zindex; Vr=M.VR(Indices,1)/M.vlight; Vz=M.VZ(Indices,1)/M.vlight; Vthet=M.VTHET(Indices,1)/M.vlight; Indicesend=M.Rindex(:,end)==Rindex & M.Zindex(:,end)==Zindex; Vrend=M.VR(Indicesend,end)/M.vlight; Vzend=M.VZ(Indicesend,end)/M.vlight; Vthetend=M.VTHET(Indicesend,end)/M.vlight; binwidth=0.1; f=figure('Name',sprintf("%s v distrib",M.file)); tstudied=0; legtext=sprintf("t=%2.1f [ns]",M.tpart(end)*1e9); subplot(1,3,1) h1=histogram(Vr,'Binwidth',binwidth,'Normalization','probability','DisplayName',sprintf("t=%2.3d [ns]",M.tpart(1)*1e9)); hold on h1=histogram(Vrend,'Binwidth',binwidth,'Normalization','probability','DisplayName',sprintf("t=%2.3d [ns]",M.tpart(end)*1e9)); ylabel('probability') xlabel('\beta_r') grid on ax2=subplot(1,3,2); binwidth=0.01; h1=histogram(Vthet(:,1),'Binwidth',binwidth,'Normalization','probability','DisplayName',sprintf("t=%2.3d [ns]",M.tpart(1)*1e9)); hold on h1=histogram(Vthetend,'Binwidth',binwidth,'Normalization','probability','DisplayName',sprintf("t=%2.3d [ns]",M.tpart(end)*1e9)); ylabel('probability') xlabel('\beta_\theta') legend(ax2,'location','northoutside','orientation','vertical') grid on subplot(1,3,3) binwidth=0.1; h1=histogram(Vz(:,1),'Binwidth',binwidth,'Normalization','probability','DisplayName',sprintf("t=%2.3d [ns]",M.tpart(1)*1e9)); hold on h1=histogram(Vzend,'Binwidth',binwidth,'Normalization','probability','DisplayName',sprintf("t=%2.3d [ns]",M.tpart(end)*1e9)); ylabel('probability') xlabel('\beta_z') grid on f=gcf; sgtitle(sprintf('R=%1.2e[m] Z=%1.2e[m] dt=%1.2e[ns]',M.rgrid(Rindex+1),M.zgrid(Zindex+1),M.dt*1e9)) f.PaperOrientation='landscape'; f.PaperUnits='centimeters'; papsize=[16 10]; f.PaperSize=papsize; [~, name, ~] = fileparts(M.file); print(f,sprintf('%sParts_V_RZ',name),'-dpdf','-fillpage') savefig(f,sprintf('%sParts_V_RZ',name))